Connecting Tech Pros Worldwide Help | Site Map

Dynamically Created Eventhandler and passing the textbox value

Newbie
 
Join Date: Aug 2007
Posts: 14
#1: Mar 10 '08
Hello all
I am new to VB.NET. I am trying to create dynamically objects and giving them the event handles. Something like this

Dim NewTab As New TabPage
Dim NewTextBox As New TextBox
Dim NewTab2 As New TabPage
Dim b As New Button

AddHandler b.Click, AddressOf b1

Me.TabControl1.Controls.Add(NewTab)

NewTab.Controls.Add(NewTextBox)
NewTab.Controls.Add(b)

Private Sub b1(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox("Here I want the value of the textbox")
End Sub

I created a new tab and add two controls to it. One button and one textbox. Then i attached click event to the button. Now I want that onclick, I can see the text of the textbox of the tabpage.
Actually i am making on pressing F4
key a new tabpage, and on that page i have a button and a text box. I call a button:
Dim b as new Button and box as Dim t as new Textbox

Now I added a handler for click.

Now How can I pass the text box value to a handler function? i.e. how can I see the text box value after clciking the button.
May be somebody can help me.
Reply