Thanks Zacks
I knew it had something to do with sender but I couldn't figure it out.
Now you might be able to answer this for me.
Right now, I have a button on the form and when I click the button the new
buttons are created and added.
In my code I have the following
AddHandler btn.Click, AddressOf btn_Click
What I would like to do is generate everything while the frmSplash is up.
The only thing I am having a problem with is creating the handler on one
form to be used on another.
so frmSplash is displayed at startup and querys the database, then from
there creats the buttons on frmMain and creates the handler for the
btn_Click to work on frmMain when it is displayed.
Any ideas?
Thanks for all your help
Charlie
<za***@construction-imaging.comwrote in message
news:39**********************************@s8g2000p rg.googlegroups.com...
On Jan 15, 10:41 am, "Charles May" <nu...@bidniz.comwrote:
I have a form that creates a button for each employee in the database. I
have added the click handler and have this working. The buttons contain
the
employee's name for their respective .Text and I have included a number in
the tag field. My problem is now, finding out which button is being
clicked
so that I can pull the information from the database.
How can I get the tag value of the button clicked?
Also... what type of information can I store in the tag field of the
control? I would like to store the EmployeeID (which is generated by
MSAccess Autonumber) so that when the button is clicked, I can query the
database to get the information needed.
In the Button Click event hander add a line:
Dim btn as Button = sender
Then you can reference all properties of the button that signalled the
event with the btn variable, as in btn.Tag.