473,382 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to make an array of Forms

snehil
19
Hey,
Can any one help me with this problem.. i'ld really appreciate ne help..
wat i wanna do is.. dat i want to dynamically create objects on a way that they could be created in a loop..
so i thot an array of object could help
so i went ahead and wrote this code in a form load event..
Expand|Select|Wrap|Line Numbers
  1. Form1[] formarray = new Form1[4];
  2. for (int i = 0; i < 4; i++)
  3.     {
  4.         formarray[i] = new Form1();
  5.         formarray[i].Show(); 
  6.     }
  7.  

but at the line

Expand|Select|Wrap|Line Numbers
  1. formarray[i].Show(); 
I get this exception
Error creating window handle.
As u mite have guessed from the code.. wat i wanna do is to open 'n' no. of forms while loading.. and n will differ every time .. actually it will depend upon the no of records in some table and i want the no. of forms to be equal to the no. of records.
Aug 28 '10 #1
1 5104
GaryTexmo
1,501 Expert 1GB
I reproduced your code (kinda... more in a sec) and it actually worked fine. Maybe post more details... specifically, the full source?

I noticed you had it in the Form's Load event. Is Form1 your main form or another form? Obviously it's going to produce an infinite, exponential loop as each form would generate four new forms. However, it still worked and I didn't get an exception ;)
Aug 31 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: LRW | last post by:
I did a Web search, and a deja.com search on this...and I'm finding how to make checkboxes act like radiobuttons, and other interesting behaviors, but nothing that quite answers my question. If...
5
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with...
8
by: Gustaf Liljegren | last post by:
I'd like a simple way of extracting everything that's not whitespace on each line in a file. For example, if the program encounters this line 1 2\t\t3 \t\t4 I want a string array like this ...
1
by: Magnus Gran-Jansen | last post by:
Hi, I am trying to make my C# application of windows forms (hosted in IE by using UserControl) to connect to a port on the machine the "applet" is downloaded from. It would be useful if I could...
1
by: ad | last post by:
I select a single field from a table of database, like: Select distinct EmployeeID from Employee. Have there any convenient to throw the result of select items into a static array? or I must...
2
by: Ken Allen | last post by:
I just upgraded to Visual Studio .NET and I'm impressed with the ease you can do some otherwise time consuming tasks. I've noticed that when making nonrectangular forms using the transparencykey...
9
by: Steve | last post by:
Hello, I created a structure ABC and an array of type ABC Public Structure ABC Dim str1 As String Dim int1 As Integer End Structure Public ABC1 As New ABC, ABC2 As New ABC
22
by: bela | last post by:
Hello, I am very new to JAVA. I would like to know, how to read *.csv file from java and how to save that data into an array. regards, bela
3
by: raylopez99 | last post by:
I suspect the answer to this question is that it's impossible, but how do I make the below code work, at the point where it breaks (marked below). See error CS0411 This is the complete code. ...
8
by: Sunny | last post by:
Hi, Can someone tell me, How to redefine array or make array empty or null. Here what I am trying to do. var temp = new Array(); for(i=0; i <=outstring.length-1; i++) { temp =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.