2011-12-11 156 views
-3

有没有什么办法可以在页面加载时自动按下网页上的按钮?Vb.net按钮自动按下

我已经在按钮下面的代码,以使

Dim nos() As Integer = New Integer((Convert.ToInt32(10)) - 1) {} 
     Dim i As Integer = 0 
     Do While (i < nos.Length) 
      nos(i) = (i + 1) 
      i = (i + 1) 
     Loop 
     GridView1.DataSource = nos 
     GridView1.DataBind() 
     btnInsert.Visible = True 
     btnInsert.Enabled = True 
     GridView1.Focus() 

我也贴在页面加载事件的代码,但是当页面加载它没有得到文本框的值将被插入到数据库网格视图的列它只在从按钮执行代码时才会得到值。这就是为什么我要求页面加载时自动按下按键

+0

周期??这意味着另一个回传。 – adatapost

回答

0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
a() 
End Sub 


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click 
a() 
End Sub 


Sub a() 
Dim nos() As Integer = New Integer((Convert.ToInt32(10)) - 1) {} 
    Dim i As Integer = 0 
    Do While (i < nos.Length) 
     nos(i) = (i + 1) 
     i = (i + 1) 
    Loop 
    GridView1.DataSource = nos 
    GridView1.DataBind() 
    btnInsert.Visible = True 
    btnInsert.Enabled = True 
    GridView1.Focus() 
End Sub 
+0

否亲爱的工作相同 –