|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Catch Checkbox eventsHi all. I know I can catch individual events in a sub by handling the
check state for a particular checkbox, but what if I was to catch for all check boxes? I need to check for whcih checkbox was clicked so I can pass that info into a variable for a select/case statement. Any ideas? ....I was thinking a mouse down event to get a point, but I think I need to somehow convert that to a string to compare to checkbox locations Thanks! Paul pc.h***@gmail.com Hi Paul,
You could store the necessary SELECT statement inside the tag property of the CheckBox. Have all CheckBoxes subscribe to the same CheckChanged event and assemble the SELECT string by going through all CheckBoxes and use the Tag property to assemble the proper parts. -- Happy coding! Morten Wennevik [C# MVP] Morten,
Thanks for the response. That sounds like it might work, I will go try it. I hope I didn't confuse with my semantics...not select as in SQL but a Case/Switch statement. I'm doing this in VB so its Select Case variable Case evaluated_to 'do this Case evaluated_to 'do this End Select What I need is that when a checkbox is checked I know which one was. Then instead of a bunch of if statements I use a case statement to determine which box and I can take action based on that. The action is actually determining which column name should be used to describe their data. They might have a First Name and Last Name column whereas I need Full name. So they click a chkbox and a column and I know what their column actually is, then I can map it correctly. This way I can get an address file in any format and get the data I need in righ format. this mapping control allows user to describe their data so it can account for anything. I've seen people put Street number in one column, street name in another, city and state in the next, 5 digit zip next, and then the carrier route in another. Obviously that format isn't USPS standards conforming so I need to parse it and combine as needed to apply this list to mailings. What I might ttry also is to create a custom message and have the checkbox throw it when checked with the wParam as an indicator of which box was checked, then I can catch that to figure it out. Thanks for the help!! |
|||||||||||||||||||||||