473,407 Members | 2,598 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,407 software developers and data experts.

radio button user settings

I am having problems on getting the radio button to work with my.settings
correctly. I want the program to check to see which one was last saved to use
at startup. The closest I have come is that I need to click the radio button
twice for it to be saved correctly.
Any idea on what to use? I think the code should be fairly simple but I am
missing it for some reason.
Apr 16 '06 #1
10 2594

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com...
I am having problems on getting the radio button to work with my.settings
correctly. I want the program to check to see which one was last saved to
use
at startup. The closest I have come is that I need to click the radio
button
twice for it to be saved correctly.


Huh? You'd need to set a flag and persist that to reuse it.

Apr 16 '06 #2


"Homer J Simpson" wrote:

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com...
I am having problems on getting the radio button to work with my.settings
correctly. I want the program to check to see which one was last saved to
use
at startup. The closest I have come is that I need to click the radio
button
twice for it to be saved correctly.


Huh? You'd need to set a flag and persist that to reuse it.

I save the new settings after clicking the other radio button. After clicking the radio button once the labels.text would update like it is supposed to but neither radio button would show as being selected. The second click would show the selected radio button andupon the next startup would correctly show as being correct.

Does this make any more sense? I'll post the code if you wish to see it.
Apr 16 '06 #3

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
I save the new settings after clicking the other radio button. After
clicking the radio button once the labels.text would update like it is
supposed to but neither radio button would show as being selected. The
second click would show the selected radio button and upon the next
startup would correctly show as being correct.
Does this make any more sense? I'll post the code if you wish to see it.


Looks like there is something wrong with the radio button setup in that
case. Try creating a new solution with just the radio buttons and see if
they work OK.

Apr 17 '06 #4
OK, thanks Homer. I'll try this tomorrow

"Homer J Simpson" wrote:

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
I save the new settings after clicking the other radio button. After
clicking the radio button once the labels.text would update like it is
supposed to but neither radio button would show as being selected. The
second click would show the selected radio button and upon the next
startup would correctly show as being correct.
Does this make any more sense? I'll post the code if you wish to see it.


Looks like there is something wrong with the radio button setup in that
case. Try creating a new solution with just the radio buttons and see if
they work OK.

Apr 17 '06 #5
Here is what I have for code but it still does not work. Any help would be
greatly appreciated:
Public Class Form1

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged,
RadioButton2.CheckedChanged
Call settings()
End Sub

Public Sub settings()
If RadioButton1.Checked = True Then
Me.Text = "Imperial"
My.Settings.Imperial = True
ElseIf RadioButton2.Checked = True Then
Me.Text = "Metric"
My.Settings.Metric = True
End If
My.Settings.Save()
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Call settings()
End Sub
End Class

"Scuba Rob" wrote:
OK, thanks Homer. I'll try this tomorrow

"Homer J Simpson" wrote:

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
I save the new settings after clicking the other radio button. After
clicking the radio button once the labels.text would update like it is
supposed to but neither radio button would show as being selected. The
second click would show the selected radio button and upon the next
startup would correctly show as being correct.
Does this make any more sense? I'll post the code if you wish to see it.


Looks like there is something wrong with the radio button setup in that
case. Try creating a new solution with just the radio buttons and see if
they work OK.

Apr 18 '06 #6

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
Here is what I have for code but it still does not work. Any help would be
greatly appreciated:


I put both buttons in a GroupBox.

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, _
RadioButton2.CheckedChanged
If RadioButton1.Checked = True Then
Me.Text = "Imperial"
Else
Me.Text = "Metric"
End If
End Sub

Apr 18 '06 #7
This part always worked fine. I need to store the radio button setting state
in the settings so upon startup it remembers which system to use, metric or
imperial. I have the Metric and Imperial setup in the settings as boolean.

Rob

"Homer J Simpson" wrote:

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
Here is what I have for code but it still does not work. Any help would be
greatly appreciated:


I put both buttons in a GroupBox.

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, _
RadioButton2.CheckedChanged
If RadioButton1.Checked = True Then
Me.Text = "Imperial"
Else
Me.Text = "Metric"
End If
End Sub

Apr 18 '06 #8

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
This part always worked fine. I need to store the radio button setting
state
in the settings so upon startup it remembers which system to use, metric
or
imperial. I have the Metric and Imperial setup in the settings as boolean.


Some have suggested that using a .ini file is easier and more reliable than
using the 'settings'. Or you could use the registry which is also pretty
reliable.

If you want to use My.Settings consider storing the state of 'Imperial' only
(True or False).
Apr 18 '06 #9
Homer,
I finally have got it to work using the My.Settings. Took me a few hours
playing with different settings but seems to work fine in the test
application.
Thanks for the help. I can send the code if anyone wants it.

Rob

"Homer J Simpson" wrote:

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
This part always worked fine. I need to store the radio button setting
state
in the settings so upon startup it remembers which system to use, metric
or
imperial. I have the Metric and Imperial setup in the settings as boolean.


Some have suggested that using a .ini file is easier and more reliable than
using the 'settings'. Or you could use the registry which is also pretty
reliable.

If you want to use My.Settings consider storing the state of 'Imperial' only
(True or False).

Apr 19 '06 #10

"Scuba Rob" <Sc******@discussions.microsoft.com> wrote in message
news:6E**********************************@microsof t.com...
Homer,
I finally have got it to work using the My.Settings. Took me a few hours
playing with different settings but seems to work fine in the test
application.
Thanks for the help. I can send the code if anyone wants it.


OK. Quite a learning curve for us all on .Net!


Apr 19 '06 #11

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

Similar topics

3
by: M.E. | last post by:
Hi I have 4 radio buttons. each button to determine which page to go to. But before page open user enters username in a text box. So when submitted, Page opens relevant to that user displaying...
3
by: elhombrebala | last post by:
With this script I can force the user to select the checkbox befor continuing, but now I have a menu with lots of radio unputs and I woul like the user to select at least 2 of them; how can I check...
1
by: Frank Xia | last post by:
I have a lot of grouped radio buttons on 7 tab pages (in one tab control). What I want to achieve is once user click "Complete" button all radio buttons get locked and user could not change any...
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,...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
1
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
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...
2
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.