|
-
Aug 20th, 2006, 04:59 AM
#1
Thread Starter
Member
[2.0] Accessing other form's control object
i've 2 child forms in one parent mdi form.
Is it possible one child form access the other child form's control ? (such as label, etc)..
what is the safe way to do this ? will it give cross thread error ?
(actually i just want a form which is specialized to display some data, and another form to give command to the first form.)
Last edited by ini_hendry; Aug 20th, 2006 at 05:03 AM.
-
Aug 20th, 2006, 05:48 AM
#2
Re: [2.0] Accessing other form's control object
There are no threads involved. Just like in any other situation it comes down to one object accessing members of another object. To do so the first object must have a reference to the second, just like always. The parent form is the link. It will presumably be creating both child forms so it will have to pass the first form a reference to the second. It's just like if you had two friends who didn't know each other who needed to talk. You'd give one of them the other one's phone number so that they could contact them. This is the same thing.
-
Aug 21st, 2006, 08:19 AM
#3
Thread Starter
Member
Re: [2.0] Accessing other form's control object
thx jm for the reply
but i really don't know how to do what u say.
can give me an example concrete code ?
or maybe a link so that i can master this ?
-
Aug 21st, 2006, 08:35 AM
#4
Re: [2.0] Accessing other form's control object
Check out the "Forms in VB.NET" tutorial in my signature. The principles are exactly the same as for C# and you can use one of the code converter links in my signature if you need to convert the code samples. Remember that everything in .NET is an object and forms are no different. You've already done before exactly what you need to do here. It's just that you don't recognise it because, like so many other people, you can't see that forms are just like other objects.
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
|