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. Extracting controls from a vb form in vb.net

Extracting controls from a vb form in vb.net

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
10 Posts 2 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.
  • M Offline
    M Offline
    mian rashed
    wrote on last edited by
    #1

    how should i extract the controls from vb form through code??????????????:^) Mian Rashed Inam Khattak

    T 1 Reply Last reply
    0
    • M mian rashed

      how should i extract the controls from vb form through code??????????????:^) Mian Rashed Inam Khattak

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

      what is for you "extracting a control from a form" please ?


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

      M 1 Reply Last reply
      0
      • T toxcct

        what is for you "extracting a control from a form" please ?


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

        M Offline
        M Offline
        mian rashed
        wrote on last edited by
        #3

        i have placed textboxes and some buttons on a form in a group box. now i want to control thse text boxes in a module. what should i do? Mian Rashed Inam Khattak

        T 1 Reply Last reply
        0
        • M mian rashed

          i have placed textboxes and some buttons on a form in a group box. now i want to control thse text boxes in a module. what should i do? Mian Rashed Inam Khattak

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

          if you made yourform correctly, the controls on it are declare at least protected, better private. you cannot so access them from outside the form... i don't really understand why you want to do such a thing ? can you light my thought please ?


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

          M 1 Reply Last reply
          0
          • T toxcct

            if you made yourform correctly, the controls on it are declare at least protected, better private. you cannot so access them from outside the form... i don't really understand why you want to do such a thing ? can you light my thought please ?


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

            M Offline
            M Offline
            mian rashed
            wrote on last edited by
            #5

            oh sure. actually i have placed textboxes on a form which are disabled by default. now i want to pass this form to a module which contains a function that is going to check that "which control is textbox" and then will enable these text boxes. now the problem is that when i pass the form to module, i cannot make it to ditinguish b/w textboxes and other controls. if not enough plz do guide me.... Mian Rashed Inam Khattak

            T 1 Reply Last reply
            0
            • M mian rashed

              oh sure. actually i have placed textboxes on a form which are disabled by default. now i want to pass this form to a module which contains a function that is going to check that "which control is textbox" and then will enable these text boxes. now the problem is that when i pass the form to module, i cannot make it to ditinguish b/w textboxes and other controls. if not enough plz do guide me.... Mian Rashed Inam Khattak

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

              mian rashed wrote: a function that is going to check that "which control is textbox" why, are your controls created dynamically ? don't the textbox always have the same ids ? the form should be modified from within it, so, i suggest you to make a public function on your form, that is subject to be called by your module (so, you'll have the effect that the moddule actually updates the controls' statuses...


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

              M 2 Replies Last reply
              0
              • T toxcct

                mian rashed wrote: a function that is going to check that "which control is textbox" why, are your controls created dynamically ? don't the textbox always have the same ids ? the form should be modified from within it, so, i suggest you to make a public function on your form, that is subject to be called by your module (so, you'll have the effect that the moddule actually updates the controls' statuses...


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

                M Offline
                M Offline
                mian rashed
                wrote on last edited by
                #7

                ok now thats a good solution. the form stores all the controls in an array what is the name of that array? Mian Rashed Inam Khattak

                1 Reply Last reply
                0
                • T toxcct

                  mian rashed wrote: a function that is going to check that "which control is textbox" why, are your controls created dynamically ? don't the textbox always have the same ids ? the form should be modified from within it, so, i suggest you to make a public function on your form, that is subject to be called by your module (so, you'll have the effect that the moddule actually updates the controls' statuses...


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

                  M Offline
                  M Offline
                  mian rashed
                  wrote on last edited by
                  #8

                  thats nice one mate, but could you tell what array does the form uses for the purpose of storing controls. thanks Mian Rashed Inam Khattak

                  T 1 Reply Last reply
                  0
                  • M mian rashed

                    thats nice one mate, but could you tell what array does the form uses for the purpose of storing controls. thanks Mian Rashed Inam Khattak

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

                    if you reach the code of your frame, you'll see into the constructor (New()) a call to InitializeComponent(). in this function, I found the first line as

                    Me.components = New System.ComponentModel.Container

                    i so think that they are stocked there. but you still don't answer my question : why don't you use the identification name of each control (which must be unique) ?


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

                    M 1 Reply Last reply
                    0
                    • T toxcct

                      if you reach the code of your frame, you'll see into the constructor (New()) a call to InitializeComponent(). in this function, I found the first line as

                      Me.components = New System.ComponentModel.Container

                      i so think that they are stocked there. but you still don't answer my question : why don't you use the identification name of each control (which must be unique) ?


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

                      M Offline
                      M Offline
                      mian rashed
                      wrote on last edited by
                      #10

                      the reason for doing so is that i have almost 13 textboxes on the form and i dont want to control each of them separately. any ways thanks for the help i think this will help my problem to be worked out. thanks once again. Mian Rashed Inam Khattak

                      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