|
-
Jul 28th, 2004, 02:59 PM
#1
set a reference in form2 to already open form1
In VB6 you could call any public method or variable in Form1 from Form2 by qualifying it with Form1
'IN FORM2
msgbox Form1.txtName.Text
in VB.NET though this doesnt work.
Let says I have a listview on Form1 that I want to access from form2. If I assign the form to an instance variable of that form
Dim x as New Form1
x.ListView1
this works, but it creates a new instance of Form1. If form1 is already open how can I set a reference to it in Form2 so I can access its controls?
-
Jul 28th, 2004, 03:55 PM
#2
http://msdn.microsoft.com/library/de...adingToNET.asp
this is a good article talking about this if anyone else is interested
How i solved my particular problem though, was to start the app from Sub Main in a module, and in the module my main form was declared as public, and that way it can be accessed by all other forms via its instance name.
-
Jul 28th, 2004, 04:55 PM
#3
Fanatic Member
Originally posted by kleinma
http://msdn.microsoft.com/library/de...adingToNET.asp
this is a good article talking about this if anyone else is interested
How i solved my particular problem though, was to start the app from Sub Main in a module, and in the module my main form was declared as public, and that way it can be accessed by all other forms via its instance name.
hehe, i just did a post very similiar to this only a few hours before this!
http://www.vbforums.com/showthread.p...hreadid=290976
its the last post, the thread i started ages ago so i wouldn't bother reading it, just the last post i included
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
|