|
-
Jun 21st, 2007, 09:10 AM
#1
Thread Starter
Addicted Member
Open Multiple forms
Hi All,
I have a question regarding an application that I am working on. I want to create multiple datagrid/dataset based on the value that the user inputs into a numericUpDown control. I want to be able to store data in multiple datagrid based on the value that is entered into the NumericUpDown control.
For example if the user enters the value 2 into the numericUpDown control I want the program to create two datagrid in separate forms (datagrid1 in one form and datagrid2 in second form).
I am using VB.Net 2003.
Any help on this would be greately apprecaited. thanks
-Srig
-
Jun 21st, 2007, 09:13 AM
#2
Re: Open Multiple forms
Do you know how to create and display one form? If so then you simply execute the same code more than once. How do you do the same thing more than once? You use a loop. How do you determine how many times to loop? From the Value property of the NUD.
-
Jun 21st, 2007, 10:46 AM
#3
Thread Starter
Addicted Member
Re: Open Multiple forms
Here is what I have thus far:
Code:
'To create a form, and to display it I would do this:
DIM myForm1 as NEW NAME
myForm1.ShowDialog()
Code:
'Now to Create Multiple form based on the the value inside of NUD
DIM I as Integer
DIM FORM AS NEW Name
For i = Value_Increment.Value to 10 Step Value_Increment.Value
myForm(i).showDialog '<== it gives me an error in this line. why?
Next
Can you tell me what I am missing here. I have followed what was recommended.
-
Jun 21st, 2007, 10:51 AM
#4
Thread Starter
Addicted Member
Re: Open Multiple forms
the above code works but not the way I want it to work. It opens the same form twice. Instead, I want to open two different forms, each containing different datagrid.
-
Jun 21st, 2007, 11:37 AM
#5
Hyperactive Member
Re: Open Multiple forms
myForm(i).showDialog is referring to an ARRAY called myForm -
-
Jun 21st, 2007, 06:56 PM
#6
Re: Open Multiple forms
If that first code snippet is what you do to open one form then that second snippet is NOT executing that operation multiple times. If the code to open one form is X then to perform X the number of times specified in a NumericUpDown would be:
vb.net Code:
For i As Integer = 1 To CInt(myNumericUpDown.Value) Step 1
X
Next i
Your first code snippet is X.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|