How to manipulate Windows forms?
-
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
-
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
-
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
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...
-
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
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.
-
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...
But, he's creating 10 of them, not just one.
Christian Graus Driven to the arms of OSX by Vista.
-
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
-
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.