2011-12-11 188 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

否親愛的工作相同 –