473,574 Members | 2,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I want to create multiple instances of a form and then refer to individual instances.

I have been writing a datalogging application. It reads in double's
into a database. I want to be able to click on a row in a database
(holds name of variable and also current value of variable) and then
instantiate a new form.

I created a new form form2 and then just on double click on a
button....

dim form as new form2
form.show

this allows me to create individual forms which I feed particular
variables.

now the issue for me is, how do i refer to each instance of form2
(want to be able to create form instances dynamically) individually.
i want to be able to send updated data from the database to each
window instance so that I can display multiple pieces of information
in individual scaleable windows..

is there a way to refer to a single instance of a new form?

Apr 13 '07 #1
6 1811
Savante,

Each time you create a new form you could add it to a collection, such as an
array, arraylist, list, hashtable, dictionary, etc.

Then you could refer to it by using an index or key.

Kerry Moorman
"Savante" wrote:
I have been writing a datalogging application. It reads in double's
into a database. I want to be able to click on a row in a database
(holds name of variable and also current value of variable) and then
instantiate a new form.

I created a new form form2 and then just on double click on a
button....

dim form as new form2
form.show

this allows me to create individual forms which I feed particular
variables.

now the issue for me is, how do i refer to each instance of form2
(want to be able to create form instances dynamically) individually.
i want to be able to send updated data from the database to each
window instance so that I can display multiple pieces of information
in individual scaleable windows..

is there a way to refer to a single instance of a new form?

Apr 13 '07 #2
On Apr 13, 1:20 pm, Kerry Moorman
<KerryMoor...@d iscussions.micr osoft.comwrote:
Savante,

Each time you create a new form you could add it to a collection, such as an
array, arraylist, list, hashtable, dictionary, etc.

Then you could refer to it by using an index or key.

Kerry Moorman

"Savante" wrote:
I have been writing a datalogging application. It reads in double's
into a database. I want to be able to click on a row in a database
(holds name of variable and also current value of variable) and then
instantiate a new form.
I created a new form form2 and then just on double click on a
button....
dim form as new form2
form.show
this allows me to create individual forms which I feed particular
variables.
now the issue for me is, how do i refer to each instance of form2
(want to be able to create form instances dynamically) individually.
i want to be able to send updated data from the database to each
window instance so that I can display multiple pieces of information
in individual scaleable windows..
is there a way to refer to a single instance of a new form?- Hide quoted text -

- Show quoted text -
thanks for the reply.

I had a bash at this last night again - had a module with
dim arrayform(100) as form1 ' (form1 is the copy of the data display
window)
and then when I click a button in frmmain it goes somthing like.

public sub button1.click.. ....
i+=1
arrayform(i)=ne w form
arrayform(i).sh ow

is this what you mean? It seems to allow me to refer to particular
windows now I think. I was going to adjust the form1_closing such
that it simply hides the window rather than deletes it and then use
the value of i as a key to identify when tooo many form1 instances
were open?

Best Regards,

Grant

Apr 14 '07 #3
Grant,

Yes, that is one of the approaches that I was suggesting.

Another option would be to add each form to an arraylist or list. Then you
would not have to manage the size of the collection. Each new form could be
added to the collection without having to keep track of the size of the
collection or the index value, etc.

Kerry Moorman
"Savante" wrote:
>
thanks for the reply.

I had a bash at this last night again - had a module with
dim arrayform(100) as form1 ' (form1 is the copy of the data display
window)
and then when I click a button in frmmain it goes somthing like.

public sub button1.click.. ....
i+=1
arrayform(i)=ne w form
arrayform(i).sh ow

is this what you mean? It seems to allow me to refer to particular
windows now I think. I was going to adjust the form1_closing such
that it simply hides the window rather than deletes it and then use
the value of i as a key to identify when tooo many form1 instances
were open?

Best Regards,

Grant

Apr 14 '07 #4
Kerry,

Cheers,

How do I do that? :-(

in module -
dim grantform as arraylist?

and then in the class........

grantform as new form1
grantform.show?

how do I keep track of each instance of each form as it's
instanciated?

Best Regards,

Grant

Apr 15 '07 #5
On Apr 14, 4:34 pm, Kerry Moorman
<KerryMoor...@d iscussions.micr osoft.comwrote:
Grant,

Yes, that is one of the approaches that I was suggesting.

Another option would be to add each form to an arraylist or list. Then you
would not have to manage the size of the collection. Each new form could be
added to the collection without having to keep track of the size of the
collection or the index value, etc.

Kerry Moorman

"Savante" wrote:
thanks for the reply.
I had a bash at this last night again - had a module with
dim arrayform(100) as form1 ' (form1 is the copy of the data display
window)
and then when I click a button in frmmain it goes somthing like.
public sub button1.click.. ....
i+=1
arrayform(i)=ne w form
arrayform(i).sh ow
is this what you mean? It seems to allow me to refer to particular
windows now I think. I was going to adjust the form1_closing such
that it simply hides the window rather than deletes it and then use
the value of i as a key to identify when tooo many form1 instances
were open?
Best Regards,
Grant- Hide quoted text -

- Show quoted text -
Kerry,

This opens up another can of worms. I've done the following

in module - friend formlist as arraylist

in each instance of opening a new form I've gone

dim instanceform as form
instanceform=ne w form
formlist.add(in stanceform)

and so I'm presuming that this adds each instance of the form
instantiation to arraylist at a unique index position.

I would like to be able to change values in each instance of the form
using database values, but my question is how do I address the (for
example) label1.text parameter of each particular instance of the
form?

formlist(1).lab el1.text="whate ver data I like". . . . .?

Apr 15 '07 #6
On Apr 15, 2:00 pm, "Savante" <grant.thom...@ savante.co.ukwr ote:
On Apr 14, 4:34 pm, Kerry Moorman

<KerryMoor...@d iscussions.micr osoft.comwrote:
Grant,
Yes, that is one of the approaches that I was suggesting.
Another option would be to add each form to an arraylist or list. Then you
would not have to manage the size of the collection. Each new form could be
added to the collection without having to keep track of the size of the
collection or the index value, etc.
Kerry Moorman
"Savante" wrote:
thanks for the reply.
I had a bash at this last night again - had a module with
dim arrayform(100) as form1 ' (form1 is the copy of the data display
window)
and then when I click a button in frmmain it goes somthing like.
public sub button1.click.. ....
i+=1
arrayform(i)=ne w form
arrayform(i).sh ow
is this what you mean? It seems to allow me to refer to particular
windows now I think. I was going to adjust the form1_closing such
that it simply hides the window rather than deletes it and then use
the value of i as a key to identify when tooo many form1 instances
were open?
Best Regards,
Grant- Hide quoted text -
- Show quoted text -

Kerry,

This opens up another can of worms. I've done the following

in module - friend formlist as arraylist

in each instance of opening a new form I've gone

dim instanceform as form
instanceform=ne w form
formlist.add(in stanceform)

and so I'm presuming that this adds each instance of the form
instantiation to arraylist at a unique index position.

I would like to be able to change values in each instance of the form
using database values, but my question is how do I address the (for
example) label1.text parameter of each particular instance of the
form?

formlist(1).lab el1.text="whate ver data I like". . . . .?- Hide quoted text -

- Show quoted text -
awesome!! thanks!

Apr 16 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6191
by: Daylor | last post by:
in win32 process , when u create new process,u have new main thread. i know,appDomain r logical procces,that exists in 1 win32 process. the q: is there way to create second appDomain (the first 1 is the defualt appDomain) with his new ("main") thread ? if not ,what is the easy and clear way to create new thread on the new appDomain ?
0
1188
by: fchef | last post by:
I am looking for some advice on working with Multiple frame instances. Essentially I need to be able to refer to specific control values in a frame and be able to hide/show a specific frame. In VB you can reference a particular frame with something like Controls.Form("My form").DoSomething. Is there something analogous to this in Python? Or...
12
3210
by: (Pete Cresswell) | last post by:
I know I can open many instances of a given form, but I've never done it. Now I'm analyzing an application where that seems like just the ticket: Many investment funds, *lots* of data points for each fund, and a desire by the users to see several funds presented side-by-side. Is opening, say, five instances of the same form...
2
1660
by: Helen Trim | last post by:
I have an application with three forms that are msde visible and activated when needed. It uses Word to open documents and one of the forms is opened as the Word document is closed in the DocumentBeforeClose event. It works the first time but when it makes the form visible for the second time, it freezes. Sometimes it gives an out of...
4
3279
by: GGerard | last post by:
Hello I have a program where the user can open as many instances of a form as the user wants. The only limit to how many instances can be opened is determined by the limit of the computer itself (the amount of RAM - I think). When enough instances of this form are opened and the limit of the computer is reached
5
14111
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
5
3301
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening the forms all at once, I'm opening them as needed. I have a main form with multiple records; and then I have a pop-up form that the user opens with...
4
2682
by: nottarealaddress | last post by:
I'm trying to get my feet wet in VB2005 (our new standard at work after officially stopping new development in VB6 about a month ago). I'm working with a simple sql 2005 table of 50 entries, one for each state. Each entry contains Name, postal abbreviation, etc. Just simple stuff to understand the mechanisms, syntax, etc. I'm now to the...
5
1726
by: pgrazaitis | last post by:
I cant seem to get my head wrapped around this issue, I have myself so twisted now there maybe no issue! Ok so I designed a class X that has a few members, and for arguments sake one of the members Y is the location of a file to be read. The original design assumes that this class will be instantiated and each instance will happily mange...
0
7736
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8249
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5305
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3743
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3755
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2251
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1350
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1066
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.