PC Review


Reply
Thread Tools Rate Thread

Controlling one form from another form

 
 
Robert
Guest
Posts: n/a
 
      16th Jul 2004
In VB 6.0 I could control the properties of one form by
writing code in another form, something like this:

In the code of Form2 I would write Form1.Visible=True.

How can I do this in VB. NET?
 
Reply With Quote
 
 
 
 
BluDog
Guest
Posts: n/a
 
      16th Jul 2004
>In VB 6.0 I could control the properties of one form by
>writing code in another form, something like this:
>
>In the code of Form2 I would write Form1.Visible=True.
>
>How can I do this in VB. NET?


The second form needs to know about the instance of the original form.
Therefore create a Public Variable/Property of type of your original
form on the second form:

<code>
[Form1]
Private Sub SomeEvent(sender As Object, e As EventArgs)

Dim secondForm As New Form2
secondForm.OtherForm = Me
secondForm.Show

End Sub

[Form2]
Public OtherForm As Form

Private Sub SomeEvent(sender As Object, e As EventArgs)
'Do what you want eith OtherForm properties
OtherForm.BackColor = Color.Blue
End Sub
</code>

Hope this helps

Blu
 
Reply With Quote
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      16th Jul 2004
Hi,

You need to keep a reference to the form to be able to modify it.
Here is a link to an article that show how to keep a forms collection.

http://msdn.microsoft.com/library/de...et05132003.asp

Ken
-------------------------------
"Robert" <(E-Mail Removed)> wrote in message
news:2e99d01c46b1d$29f2d420$(E-Mail Removed)...
> In VB 6.0 I could control the properties of one form by
> writing code in another form, something like this:
>
> In the code of Form2 I would write Form1.Visible=True.
>
> How can I do this in VB. NET?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling a Sub Form PosseJohn Microsoft Access Form Coding 4 18th Jan 2010 11:59 PM
Re: Controlling Sub Form Properties Jeanette Cunningham Microsoft Access Form Coding 0 17th Mar 2009 06:55 PM
Two subroutines controlling one form jeh Microsoft Access Forms 4 15th Aug 2008 11:40 PM
Controlling graph in a Form darren via AccessMonster.com Microsoft Access Form Coding 1 18th Jun 2007 01:25 PM
controlling tab behavior on a form thrashin via AccessMonster.com Microsoft Access Forms 4 19th May 2006 06:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:02 AM.