laredo512 Posted August 12, 2005 Posted August 12, 2005 For the advanced crowd, this is most likely the simplest and perhaps the supidest thing you've seen posted here, but for newbies, this could save alot of coding time... Say you have a form that has multiple radio buttons in the same list, groupbox or form and you want to trigger different events for each radio button that is checked at the time you program final input checking, a simple select statement can help you with this. So, let's say you have three radio buttons and want to find out which is checked: radYES radNO RadCANCEL [size=2][color=#0000ff] Select [/color][/size][size=2][color=#0000ff]Case [/color][/size][size=2][color=#0000ff]True [indent][/color][/size][size=2][color=#0000ff]Case [/color][/size][size=2][color=#0000ff]Is[/color][/size][size=2] = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].radYES.Checked [/size][size=2][color=#008000]'YES selected [/color][/size][size=2][color=#0000ff]Case [/color][/size][size=2][color=#0000ff]Is[/color][/size][size=2] = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].radNO.Checked [/size][size=2][color=#008000]'NO Selected [/color][/size][size=2][color=#0000ff]Case [/color][/size][size=2][color=#0000ff]Is[/color][/size][size=2] = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].radCANCEL.Checked [/size][size=2][color=#008000]'CANCEL Selected [/indent] [/color][/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Select [/color][/size] Personnally, I use this when I run final checks on the form inputs before sending the info to the database. It permits me to modify data based on which option is checked by the user. Hope this can help a few. Quote Laredo512 * using VS.NET Pro 2003 *
Leaders Iceplug Posted August 12, 2005 Leaders Posted August 12, 2005 Well, first of all, the Is = part is unnecessary, because Me.radYes.Checked is a boolean anyway. And besides, what would be the advantage over just using an If Else block? If Me.radYESChecked Then ElseIf Me.radNOChecked Then ElseIf Me.radCANCEL.Checked Then End If it would be less typing and more intuitive. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.