radio button user settings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scuba Rob

    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.
  • Homer J Simpson

    #2
    Re: radio button user settings


    "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
    news:6F2E2D91-3681-41D4-93E4-30640DF991A1@mi crosoft.com...
    [color=blue]
    > 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.[/color]

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



    Comment

    • Scuba Rob

      #3
      Re: radio button user settings



      "Homer J Simpson" wrote:
      [color=blue]
      >
      > "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
      > news:6F2E2D91-3681-41D4-93E4-30640DF991A1@mi crosoft.com...
      >[color=green]
      > > 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.[/color]
      >
      > 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.[/color]
      Does this make any more sense? I'll post the code if you wish to see it.

      Comment

      • Homer J Simpson

        #4
        Re: radio button user settings


        "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
        news:4777F681-13C2-4D21-8F94-62FC0C955C5A@mi crosoft.com...
        [color=blue]
        > 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.[/color]

        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.



        Comment

        • Scuba Rob

          #5
          Re: radio button user settings

          OK, thanks Homer. I'll try this tomorrow

          "Homer J Simpson" wrote:
          [color=blue]
          >
          > "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
          > news:4777F681-13C2-4D21-8F94-62FC0C955C5A@mi crosoft.com...
          >[color=green]
          > > 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.[/color]
          >
          > 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.
          >
          >
          >
          >[/color]

          Comment

          • Scuba Rob

            #6
            Re: radio button user settings

            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(B yVal sender As System.Object, ByVal e As
            System.EventArg s) Handles Button2.Click
            End
            End Sub

            Private Sub RadioButton1_Ch eckedChanged(By Val sender As System.Object,
            ByVal e As System.EventArg s) Handles RadioButton1.Ch eckedChanged,
            RadioButton2.Ch eckedChanged
            Call settings()
            End Sub

            Public Sub settings()
            If RadioButton1.Ch ecked = True Then
            Me.Text = "Imperial"
            My.Settings.Imp erial = True
            ElseIf RadioButton2.Ch ecked = True Then
            Me.Text = "Metric"
            My.Settings.Met ric = True
            End If
            My.Settings.Sav e()
            End Sub

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

            "Scuba Rob" wrote:
            [color=blue]
            > OK, thanks Homer. I'll try this tomorrow
            >
            > "Homer J Simpson" wrote:
            >[color=green]
            > >
            > > "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
            > > news:4777F681-13C2-4D21-8F94-62FC0C955C5A@mi crosoft.com...
            > >[color=darkred]
            > > > 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.[/color]
            > >
            > > 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.
            > >
            > >
            > >
            > >[/color][/color]

            Comment

            • Homer J Simpson

              #7
              Re: radio button user settings


              "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
              news:7F14B393-7962-46D3-9FF5-9325D8817876@mi crosoft.com...[color=blue]
              > Here is what I have for code but it still does not work. Any help would be
              > greatly appreciated:[/color]

              I put both buttons in a GroupBox.

              Private Sub RadioButton1_Ch eckedChanged(By Val sender As System.Object, _
              ByVal e As System.EventArg s) Handles RadioButton1.Ch eckedChanged, _
              RadioButton2.Ch eckedChanged
              If RadioButton1.Ch ecked = True Then
              Me.Text = "Imperial"
              Else
              Me.Text = "Metric"
              End If
              End Sub



              Comment

              • Scuba Rob

                #8
                Re: radio button user settings

                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:
                [color=blue]
                >
                > "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
                > news:7F14B393-7962-46D3-9FF5-9325D8817876@mi crosoft.com...[color=green]
                > > Here is what I have for code but it still does not work. Any help would be
                > > greatly appreciated:[/color]
                >
                > I put both buttons in a GroupBox.
                >
                > Private Sub RadioButton1_Ch eckedChanged(By Val sender As System.Object, _
                > ByVal e As System.EventArg s) Handles RadioButton1.Ch eckedChanged, _
                > RadioButton2.Ch eckedChanged
                > If RadioButton1.Ch ecked = True Then
                > Me.Text = "Imperial"
                > Else
                > Me.Text = "Metric"
                > End If
                > End Sub
                >
                >
                >
                >[/color]

                Comment

                • Homer J Simpson

                  #9
                  Re: radio button user settings


                  "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
                  news:D2F3805D-D918-4DD7-B617-A0D376A06634@mi crosoft.com...
                  [color=blue]
                  > 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.[/color]

                  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).


                  Comment

                  • Scuba Rob

                    #10
                    Re: radio button user settings

                    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:
                    [color=blue]
                    >
                    > "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
                    > news:D2F3805D-D918-4DD7-B617-A0D376A06634@mi crosoft.com...
                    >[color=green]
                    > > 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.[/color]
                    >
                    > 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).
                    >
                    >
                    >[/color]

                    Comment

                    • Homer J Simpson

                      #11
                      Re: radio button user settings


                      "Scuba Rob" <ScubaRob@discu ssions.microsof t.com> wrote in message
                      news:6EE450A1-94C8-4B1E-9DB2-BB539F010EB4@mi crosoft.com...
                      [color=blue]
                      > 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.[/color]

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






                      Comment

                      Working...