|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
radio button user settingsI 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. "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message Huh? You'd need to set a flag and persist that to reuse it.news:6F2E2D91-3681-41D4-93E4-30640DF991A1@microsoft.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.
Show quote
Hide quote
"Homer J Simpson" wrote: Does this make any more sense? I'll post the code if you wish to see it.> > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message > news:6F2E2D91-3681-41D4-93E4-30640DF991A1@microsoft.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. "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message Looks like there is something wrong with the radio button setup in that news:4777F681-13C2-4D21-8F94-62FC0C955C5A@microsoft.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. case. Try creating a new solution with just the radio buttons and see if they work OK. OK, thanks Homer. I'll try this tomorrow
Show quoteHide quote "Homer J Simpson" wrote: > > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message > news:4777F681-13C2-4D21-8F94-62FC0C955C5A@microsoft.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. > > > > 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 Show quoteHide quote "Scuba Rob" wrote: > OK, thanks Homer. I'll try this tomorrow > > "Homer J Simpson" wrote: > > > > > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message > > news:4777F681-13C2-4D21-8F94-62FC0C955C5A@microsoft.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. > > > > > > > > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message I put both buttons in a GroupBox.news:7F14B393-7962-46D3-9FF5-9325D8817876@microsoft.com... > Here is what I have for code but it still does not work. Any help would be > greatly appreciated: 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 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 Show quoteHide quote "Homer J Simpson" wrote: > > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message > news:7F14B393-7962-46D3-9FF5-9325D8817876@microsoft.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 > > > > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message Some have suggested that using a .ini file is easier and more reliable than news:D2F3805D-D918-4DD7-B617-A0D376A06634@microsoft.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. 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). 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 Show quoteHide quote "Homer J Simpson" wrote: > > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message > news:D2F3805D-D918-4DD7-B617-A0D376A06634@microsoft.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). > > > "Scuba Rob" <Scuba***@discussions.microsoft.com> wrote in message OK. Quite a learning curve for us all on .Net!news:6EE450A1-94C8-4B1E-9DB2-BB539F010EB4@microsoft.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.
PrivateFontCollection Quastion
Confused Using VB in VS2003 Populating a combobox from dataset Ticker Control Writing a Unicode String into file Proper way to accept data from sockets? VB.net windows app questioins MsChart error message in VB 2005 Starter Kit Problem Using new control that inherits from Form |
|||||||||||||||||||||||