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. How to manipulate Windows forms?

How to manipulate Windows forms?

Scheduled Pinned Locked Moved Visual Basic
winformstutorialquestion
7 Posts 3 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.
  • A Offline
    A Offline
    al2006
    wrote on last edited by
    #1

    Hi , I’m doing a little experiment. I created procedures that can create new forms at run time. ------------------------------------------ Private Sub createForms() Dim i As Integer For i = 1 To 10 newform = New Form newform.Name = "Form_" + i.ToString newform.Show() Next End Sub ------------------------------------------ Now I want to move those forms on the screen, close them one by one, change size etc. I cant find the way to acces the forms that I just created. I tried using newform.Name property but it dosent work. Any suggestions??? Thanks

    A K C 4 Replies Last reply
    0
    • A al2006

      Hi , I’m doing a little experiment. I created procedures that can create new forms at run time. ------------------------------------------ Private Sub createForms() Dim i As Integer For i = 1 To 10 newform = New Form newform.Name = "Form_" + i.ToString newform.Show() Next End Sub ------------------------------------------ Now I want to move those forms on the screen, close them one by one, change size etc. I cant find the way to acces the forms that I just created. I tried using newform.Name property but it dosent work. Any suggestions??? Thanks

      A Offline
      A Offline
      al2006
      wrote on last edited by
      #2

      I am using Visual Studio 2008 I thought it might help if I mention this info. Thanks

      1 Reply Last reply
      0
      • A al2006

        Hi , I’m doing a little experiment. I created procedures that can create new forms at run time. ------------------------------------------ Private Sub createForms() Dim i As Integer For i = 1 To 10 newform = New Form newform.Name = "Form_" + i.ToString newform.Show() Next End Sub ------------------------------------------ Now I want to move those forms on the screen, close them one by one, change size etc. I cant find the way to acces the forms that I just created. I tried using newform.Name property but it dosent work. Any suggestions??? Thanks

        K Offline
        K Offline
        Kenny McKee
        wrote on last edited by
        #3

        The newform variable can't be accessed outside of the FOR loop. I recommend making the form a global variable.

        How many bytes of text have I typed in my lifetime??? Man, I wish I kept track...

        C 1 Reply Last reply
        0
        • A al2006

          Hi , I’m doing a little experiment. I created procedures that can create new forms at run time. ------------------------------------------ Private Sub createForms() Dim i As Integer For i = 1 To 10 newform = New Form newform.Name = "Form_" + i.ToString newform.Show() Next End Sub ------------------------------------------ Now I want to move those forms on the screen, close them one by one, change size etc. I cant find the way to acces the forms that I just created. I tried using newform.Name property but it dosent work. Any suggestions??? Thanks

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          As newform is created over an over, you are basically throwing away your reference to the new forms. The Application.Forms collection is one way to find them, but you can also build your own list and keep references that are strongly typed in that.

          Christian Graus Driven to the arms of OSX by Vista.

          A 1 Reply Last reply
          0
          • K Kenny McKee

            The newform variable can't be accessed outside of the FOR loop. I recommend making the form a global variable.

            How many bytes of text have I typed in my lifetime??? Man, I wish I kept track...

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            But, he's creating 10 of them, not just one.

            Christian Graus Driven to the arms of OSX by Vista.

            1 Reply Last reply
            0
            • A al2006

              Hi , I’m doing a little experiment. I created procedures that can create new forms at run time. ------------------------------------------ Private Sub createForms() Dim i As Integer For i = 1 To 10 newform = New Form newform.Name = "Form_" + i.ToString newform.Show() Next End Sub ------------------------------------------ Now I want to move those forms on the screen, close them one by one, change size etc. I cant find the way to acces the forms that I just created. I tried using newform.Name property but it dosent work. Any suggestions??? Thanks

              A Offline
              A Offline
              al2006
              wrote on last edited by
              #6

              Thank you for the inputs. If I would do the newform global, how then i can access and change individual forms properties? Does some one can give me a workable solution Thanks again.

              1 Reply Last reply
              0
              • C Christian Graus

                As newform is created over an over, you are basically throwing away your reference to the new forms. The Application.Forms collection is one way to find them, but you can also build your own list and keep references that are strongly typed in that.

                Christian Graus Driven to the arms of OSX by Vista.

                A Offline
                A Offline
                al2006
                wrote on last edited by
                #7

                Thanks Christian for reply. Could you please give me a sample of how to use Application.Forms collection for my purpose? Thank 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