Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. radiobutton and textbox

radiobutton and textbox

Scheduled Pinned Locked Moved Visual Basic
question
15 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T toxcct

    myTextBx.Enabled = true

    where myTextBx is your textbox control


    TOXCCT >>> GEII power
    [toxcct][VisualCalc]

    A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #3

    well this is my code: - Private Sub Radiobutton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiobutton1.CheckedChanged If Radiobutton1.Checked = True Then TextBox6.Enabled = True Else TextBox6.Enabled = False End If End Sub but it is not working. no errors but not working.

    1 Reply Last reply
    0
    • T toxcct

      myTextBx.Enabled = true

      where myTextBx is your textbox control


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      M Offline
      M Offline
      Manik Nath
      wrote on last edited by
      #4

      well this is my code: - Private Sub Radiobutton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiobutton1.CheckedChanged If Radiobutton1.Checked = True Then TextBox6.Enabled = True Else TextBox6.Enabled = False End If End Sub but it is not working. no errors but not working.

      T 1 Reply Last reply
      0
      • M Manik Nath

        well this is my code: - Private Sub Radiobutton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiobutton1.CheckedChanged If Radiobutton1.Checked = True Then TextBox6.Enabled = True Else TextBox6.Enabled = False End If End Sub but it is not working. no errors but not working.

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #5

        set a breakpoint into the function and watch if the function is called... and watch also if it is going into the right case (maybe Radiobutton1.Checked is not set to what you think...)


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        M R 2 Replies Last reply
        0
        • T toxcct

          set a breakpoint into the function and watch if the function is called... and watch also if it is going into the right case (maybe Radiobutton1.Checked is not set to what you think...)


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          M Offline
          M Offline
          Manik Nath
          wrote on last edited by
          #6

          i'm still not able to figure out what exactly is the fault. or where things are goin wrong. is there any other way to make a textbox active other than using radiobuttons and buttons.

          T 1 Reply Last reply
          0
          • T toxcct

            set a breakpoint into the function and watch if the function is called... and watch also if it is going into the right case (maybe Radiobutton1.Checked is not set to what you think...)


            TOXCCT >>> GEII power
            [toxcct][VisualCalc]

            R Offline
            R Offline
            raph it
            wrote on last edited by
            #7

            try this. Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton14.CheckedChanged Dim rdoTemp As RadioButton = CType(sender, RadioButton) TextBox1.Enabled = rdoTemp.Checked End Sub

            M 1 Reply Last reply
            0
            • M Manik Nath

              i'm still not able to figure out what exactly is the fault. or where things are goin wrong. is there any other way to make a textbox active other than using radiobuttons and buttons.

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #8

              hum, no, there no other way. but i thought to something : isn't your textbox into a groupbox that is itself disabled (Enabled = false) ??


              TOXCCT >>> GEII power
              [toxcct][VisualCalc]

              M 1 Reply Last reply
              0
              • T toxcct

                hum, no, there no other way. but i thought to something : isn't your textbox into a groupbox that is itself disabled (Enabled = false) ??


                TOXCCT >>> GEII power
                [toxcct][VisualCalc]

                M Offline
                M Offline
                Manik Nath
                wrote on last edited by
                #9

                no it's directly on the webform.

                1 Reply Last reply
                0
                • R raph it

                  try this. Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton14.CheckedChanged Dim rdoTemp As RadioButton = CType(sender, RadioButton) TextBox1.Enabled = rdoTemp.Checked End Sub

                  M Offline
                  M Offline
                  Manik Nath
                  wrote on last edited by
                  #10

                  nope not working.

                  R 1 Reply Last reply
                  0
                  • M Manik Nath

                    nope not working.

                    R Offline
                    R Offline
                    raph it
                    wrote on last edited by
                    #11

                    What exactly are you trying to achieve - all the code submitted in this thread works, so I suspect that you may be doing something out of the ordinary. Is a radio button the right control for you remembering that they are grouped. Perhaps a little more explanation of the task at hand may help in providing a solution that works for you.

                    M 1 Reply Last reply
                    0
                    • R raph it

                      What exactly are you trying to achieve - all the code submitted in this thread works, so I suspect that you may be doing something out of the ordinary. Is a radio button the right control for you remembering that they are grouped. Perhaps a little more explanation of the task at hand may help in providing a solution that works for you.

                      M Offline
                      M Offline
                      Manik Nath
                      wrote on last edited by
                      #12

                      ok i'll tell you what exactly i'm trying to do. i have a dropdownlist which has a collection of various items. the user has to select anyone from it. in case the user does not find his category of items in the dropdown list then he has to click on the radiobutton which has its text as 'NOT AVAILABLE' which in turn enables the textbox and the user can type in his special category of item. and all these controls are directly on the webform.

                      R 1 Reply Last reply
                      0
                      • M Manik Nath

                        ok i'll tell you what exactly i'm trying to do. i have a dropdownlist which has a collection of various items. the user has to select anyone from it. in case the user does not find his category of items in the dropdown list then he has to click on the radiobutton which has its text as 'NOT AVAILABLE' which in turn enables the textbox and the user can type in his special category of item. and all these controls are directly on the webform.

                        R Offline
                        R Offline
                        raph it
                        wrote on last edited by
                        #13

                        Ok. Firstly, apologies,' I didn't realize that this was web based. I am not a web person myself, but the following should work. I am sure some 'true' web people out there will come up with a more elegant solution for you. Firstly, radiobuttons do NOT cause a post back to the server by default, so you must enable this (AutoPostBack property to true) Then, you can key this code into your page_load event. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then ' ' normal code to initialise the form ' Else TextBox1.Enabled = RadioButton1.Checked End If End Sub I am sure that you should be able to achieve the same results via some form of client side script, but as I said - I am not a web person, and the above code worked for me when I tested it !!

                        M 1 Reply Last reply
                        0
                        • R raph it

                          Ok. Firstly, apologies,' I didn't realize that this was web based. I am not a web person myself, but the following should work. I am sure some 'true' web people out there will come up with a more elegant solution for you. Firstly, radiobuttons do NOT cause a post back to the server by default, so you must enable this (AutoPostBack property to true) Then, you can key this code into your page_load event. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then ' ' normal code to initialise the form ' Else TextBox1.Enabled = RadioButton1.Checked End If End Sub I am sure that you should be able to achieve the same results via some form of client side script, but as I said - I am not a web person, and the above code worked for me when I tested it !!

                          M Offline
                          M Offline
                          Manik Nath
                          wrote on last edited by
                          #14

                          no need for apologies raph. it happens after all we are there to help each other. anyways thanx for urs time for my problem and ur involvement. i also found another way of doin it just some logical if else loops helped remove the loop holes.

                          1 Reply Last reply
                          0
                          • M Manik Nath

                            i want to enable a textbox by clicking on a radiobutton. i mean that when i check a radiobutton1 then a textbox called textbox1 should get enabled how do i do that.

                            A Offline
                            A Offline
                            albCode
                            wrote on last edited by
                            #15

                            If RadioButton1.Checked=true Then me.TextBox1.Enabled=true Else me.TextBox1.Enabled=false EndIf I hope this helps to you

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups