473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Radio button practical use

I have a field in a database called Language. This field may contain a E
for english or an S for spanish. I would like to use this field in
conjunction with two radio buttons. I know how to drag two radios to my
winform and put them in a groupbox. What is not clear to me is how to
populate (put a radio in) the English or Spanish radio with the value of the
language field when a new record is retrieved. What is the logic here? How
is this done?

Nov 20 '05 #1
5 4913
Thank You.

Yes but Cor, the question was not addressed.

The question is "how to populate the English or Spanish radio with the value
of the
language field when a new record is retrieved". Is there something in the
component that will do it automatically, i.e, if the field value of the
language field is S then put a dot in the Spanish radio or if the field
value is E put a dot in the English radio? If there is not something
built-in what is the method? Could someone give a code example and tell
what method it should go in?

If there is a Microsoft rep I would appreciate your input.
Nov 20 '05 #2
Cor
Woody,
Do you mean
\\\\
If X="S" then
me.radiobutton1.selected = true 'And automatic radiobutton2.selected =
false
else
me.radiobutton2.selected=true
end if
Or
If X="S" then
me.radiobutton1.text ="English"
me.radiobutton1.selected=true
me.radioButton2.text="Spanish"
Else
me.radiobutton1.text="Angli???"
me.radiobutton2.selected=true
me.radiobutton2.text="Espagnol"
end if
////
That is what I can think of very easy and after a while nice readable.

Or do you mean something like this
\\\\\
X is your database item.
Me.rdbEnglish.Checked=Ctype(Instr(X,"E"),Boolean)
me.rdbSpanish.Checked=Ctype(instr(X,"S"),Boolean)
//////
(I hope Herfried does not see this instruction, I always say I hate those
old VB functions like Instr but this one fits exact for this case)

Doing it with a bitwise operator will maybe go too, but makes is again more
unreadable I think.

One of these must do it I think

Cor
Nov 20 '05 #3
Cor
Woody
I did by accident switch in the second example again the S and the E, but
that you did see yourself I asume.
Cor
Nov 20 '05 #4
>Do you mean...

Not really. I mean I would like to know if the VS RadioButton Component has
a way of putting a dot in itself depending on the value of a given field.
When retrieving a record I do not want to have to tell VS to put a dot in
this or that button depending on the value of the Language field, I am
hoping it has the capacity to figure that out for itself. If I have to do
that each time I retrieve or move to a new record it's going to be a lot of
hassle.

Continuing, if I retreive a record to a winform and that record has a field
called language and I have two RadioButtons in a GroupBox labeled English
and Spanish, is VS smart enough to put a dot in the right radio button
depending on what is in the language field or do I have to do it myself?
If you know the answer that would be good. If not, don't feel bad, we all
don't know something, but perhaps you could help me to get an answer from
someone that does.


"Cor" <no*@non.com> wrote in message
news:3f***********************@reader20.wxs.nl...
Woody,
Do you mean
\\\\
If X="S" then
me.radiobutton1.selected = true 'And automatic radiobutton2.selected =
false
else
me.radiobutton2.selected=true
end if
Or
If X="S" then
me.radiobutton1.text ="English"
me.radiobutton1.selected=true
me.radioButton2.text="Spanish"
Else
me.radiobutton1.text="Angli???"
me.radiobutton2.selected=true
me.radiobutton2.text="Espagnol"
end if
////
That is what I can think of very easy and after a while nice readable.

Or do you mean something like this
\\\\\
X is your database item.
Me.rdbEnglish.Checked=Ctype(Instr(X,"E"),Boolean)
me.rdbSpanish.Checked=Ctype(instr(X,"S"),Boolean)
//////
(I hope Herfried does not see this instruction, I always say I hate those
old VB functions like Instr but this one fits exact for this case)

Doing it with a bitwise operator will maybe go too, but makes is again more unreadable I think.

One of these must do it I think

Cor

Nov 20 '05 #5
Cor
Woody,
I think to know what the answers will be, make you own myLanguageRadiobutton
class by inheritting from the radiobuttonclass.
But I don't believe you can do that without using in a way the code I did
supply you.
When you want to bind the data to the button, why not, but you always will
need to translate the S and E to boolean values.
And therefore you need to evaluate the codes in a way of my samples.
What would be more efficient
x = translated code
or
y = translated code
x bind y
I can not see what goal there will be with binding the data in this case.
A radiobutton has only two attributes which can have data.
And you have only 2 radiobuttons.
If you have more you can do such things in a whatever loop but it does not
change the case.
Last message from me in this thread.
Success and when you find your solution I am curious
Cor
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
3
by: John Davis | last post by:
I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons. When the user click the first radio button, the text will change to uppercase. If the user clicks the other radio button,...
3
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
8
by: David Cameron | last post by:
I noticed that using an HTMLInputRadioButton and specifying a value to be an empty string (""), this is overridden by ASP.Net which set the value of the control to be the same as the ID of the...
2
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put...
9
by: IchBin | last post by:
I can not see what the problem is with this script. I am just trying to set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry I am new to javascript. <html> <head> <script...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.