niall29 Posted September 22, 2004 Posted September 22, 2004 This is probably a silly question but I want to say if nothing is selected in the Radiobuttonlist. it will display a message box saying you need to pick one" I can get the message box but I dont know how to say if nothing is selected. Quote
maddirala Posted September 23, 2004 Posted September 23, 2004 how ur getting message box r u using java script or vb code.post ur code i can help u Quote
jdemackio Posted September 23, 2004 Posted September 23, 2004 If I'm not mistaken, I'm pretty sure that at least one radio button has to be selected at all times. Generally, if you click one, it becomes selected while the one that was previously selected becomes unselected. On the other hand, you can have no selections in a list of CheckBoxes. So if you are using a RadioButtonList you should always have one selected. Else, just have your program go through each CheckBox and evaluate its Checked property to see if any of them are checked. Quote - The only true knowledge is knowing that you know nothing.
niall29 Posted September 23, 2004 Author Posted September 23, 2004 You are right with radio buttons you have to pick one. but when the form opens none of them have been picked yet. You see I have the Radiobuttonlist set to a table and what I plan to do is link that table to another table of field names so when they pick Search by first name it will know to search the field F_name and if the user picks Last Name then it knows to search L_name but I do not want to use If and Else IF statements because what I am trying to do is Allow the user to put in new search categorys without having to change the code. i hope this helps to understand what Im trying to do and maybe its not possible but I will never find out unless I try. Quote
jdemackio Posted September 24, 2004 Posted September 24, 2004 Have a class variable: Private nOption As Int16 When the form loads, initialize nOption to -1 If user clicks on RadioButton1 (use click event) then nOption = 1 if user clicks on RadioButton2 then nOption = 2 etc.... Basically, nOption keeps track of which RadioButton is currently selected. when the user clicks Search (or whatever) then if nOption is still equal to -1, you know that the user never clicked a RadioButton. Quote - The only true knowledge is knowing that you know nothing.
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.