|
-
Jul 24th, 2003, 09:13 AM
#1
Thread Starter
Member
Adding Controls at Runtime problem
I have an odd problem that is really frustrating. I've created buttons at runtime and set up the handlers. When the user clicks the created buttons, I read the sender.text and respond to it. See below....
If sender.text.ToString = WSAnswer Then
MessageBox.Show("Yes")
PlayWhatSays()
Else
MessageBox.Show("Nope" & " " & WSAnswer & " " & sender.text.ToString)
End If
The code works well except when I click the last button created. When I do that, for some strange reason it works as planned once then for some reason the program runs the event for a second time as if the user clicked the button twice. This occurs only when I click the last button created and happens for both a correct and an incorrect answer. I have walked through this a number of time and I know that I haven't created 2 buttons on the same position. Also the PlayWhatSays event does not trigger the created buttons click event. Any help?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|