Create Button and his event
-
Hi I want to create button at run time in win mobile using vb.net 2005. and i want to create event also at run time. Please suggest. i write the following code...
dim btn as button
For i As Integer = 0 To 5
btn = New Button
btn.Text = sAppointmentTypes(i)
btn.Tag = sAppointmentTypesIds(i)
btn.Height = Label1.Height
btn.Left = Label1.Left
btn.Width = Label1.Width
btn.Top = Label1.Top + (Label1.Height * i + 1) + 50
'AddHandler btn.Click, AddressOf btn.Click
AddHandler btn.Click, AddressOf Me.ClickButton
Me.Controls.Add(btn)
NextPrivate Sub ClickButton(ByVal sender As System.Object, ByVal e As System.EventArgs)
msgbox sender.text
End Subit shows the error in sender.text. Please suggest how i do this. Thanx
~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA
-
Hi I want to create button at run time in win mobile using vb.net 2005. and i want to create event also at run time. Please suggest. i write the following code...
dim btn as button
For i As Integer = 0 To 5
btn = New Button
btn.Text = sAppointmentTypes(i)
btn.Tag = sAppointmentTypesIds(i)
btn.Height = Label1.Height
btn.Left = Label1.Left
btn.Width = Label1.Width
btn.Top = Label1.Top + (Label1.Height * i + 1) + 50
'AddHandler btn.Click, AddressOf btn.Click
AddHandler btn.Click, AddressOf Me.ClickButton
Me.Controls.Add(btn)
NextPrivate Sub ClickButton(ByVal sender As System.Object, ByVal e As System.EventArgs)
msgbox sender.text
End Subit shows the error in sender.text. Please suggest how i do this. Thanx
~Khatri Mitesh khatrimitesh@hotmail.com Bikaner (Rajasthan) INDIA