By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

Dynamically Created Eventhandler and passing the textbox value

P: 15
Hello all
I am new to VB.NET. I am trying to create dynamically objects and giving them the event handles. Something like this

Expand|Select|Wrap|Line Numbers
  1. Dim NewTab As New TabPage
  2. Dim NewTextBox As New TextBox
  3. Dim NewTab2 As New TabPage
  4. Dim b As New Button
  6. AddHandler b.Click, AddressOf b1
  8. Me.TabControl1.Controls.Add(NewTab)
  10. NewTab.Controls.Add(NewTextBox)
  11. NewTab.Controls.Add(b)
  13. Private Sub b1(ByVal sender As System.Object, ByVal e As System.EventArgs)
  14. MsgBox("Here I want the value of the textbox")
  15. 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.
Mar 9 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.