PC Review


Reply
Thread Tools Rate Thread

form1 and form2

 
 
james ou
Guest
Posts: n/a
 
      5th Nov 2003
Hi,

I create a form2 in the form1. Can I change some data
of form1 in the form2?

Thanks
 
Reply With Quote
 
 
 
 
Jeff Yang
Guest
Posts: n/a
 
      5th Nov 2003
Maybe its better to show your source code first,so we can grasp your meaning
better.

"james ou" <(E-Mail Removed)>
??????:0bf401c3a386$d9ea1e10$(E-Mail Removed)...
> Hi,
>
> I create a form2 in the form1. Can I change some data
> of form1 in the form2?
>
> Thanks



 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      5th Nov 2003
* "james ou" <(E-Mail Removed)> scripsit:
> I create a form2 in the form1. Can I change some data
> of form1 in the form2?


Are you talking about MDI forms?

--
Herfried K. Wagner
MVP ∑ VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
Reply With Quote
 
Tom Clement
Guest
Posts: n/a
 
      6th Nov 2003
Yes. One way is to set the Modifiers property of any control you want to
access on form1 to Internal or Public. Make sure you pass a reference to
form1 into form2, then, for example, use the line:
form1.TextBox1.Text = "NewText";
Tom Clement

"james ou" <(E-Mail Removed)> wrote in message
news:0bf401c3a386$d9ea1e10$(E-Mail Removed)...
> Hi,
>
> I create a form2 in the form1. Can I change some data
> of form1 in the form2?
>
> Thanks



 
Reply With Quote
 
james ou
Guest
Posts: n/a
 
      6th Nov 2003
In the form1, have a button to be clicked to create form2,
and in the form2, have a textbox to let user input some
data.Is there some way to let the form1 receive the input
data or to change some variable(data) in the form1 after
user input some data in the form2?


>-----Original Message-----
>Maybe its better to show your source code first,so we can

grasp your meaning
>better.
>
>"james ou" <(E-Mail Removed)>
>??????:0bf401c3a386$d9ea1e10$(E-Mail Removed)...
>> Hi,
>>
>> I create a form2 in the form1. Can I change some data
>> of form1 in the form2?
>>
>> Thanks

>
>
>.
>

 
Reply With Quote
 
james ou
Guest
Posts: n/a
 
      6th Nov 2003
Thanks Tom, how can I pass a reference to form1 into
form2?


>-----Original Message-----
>Yes. One way is to set the Modifiers property of any

control you want to
>access on form1 to Internal or Public. Make sure you

pass a reference to
>form1 into form2, then, for example, use the line:
> form1.TextBox1.Text = "NewText";
>Tom Clement
>
>"james ou" <(E-Mail Removed)> wrote in

message
>news:0bf401c3a386$d9ea1e10$(E-Mail Removed)...
>> Hi,
>>
>> I create a form2 in the form1. Can I change some data
>> of form1 in the form2?
>>
>> Thanks

>
>
>.
>

 
Reply With Quote
 
Tom Clement
Guest
Posts: n/a
 
      6th Nov 2003
Maybe something like this (in C#):

In form2 -- start code --

private form1 m_frmForm1;
internal form1 MyForm1 {set { m_frmForm1 = value;}}

.....
{
...
m_frmForm1.TextBox1.Text = "New Text";
}

form2 -- end code --

now in form1 -- start code --
.....
form2 myForm2 = new myForm2();
myForm2.MyForm1 = this;

form1 -- end code --


"james ou" <(E-Mail Removed)> wrote in message
news:06a901c3a42e$d2c9fe90$(E-Mail Removed)...
> Thanks Tom, how can I pass a reference to form1 into
> form2?
>
>
> >-----Original Message-----
> >Yes. One way is to set the Modifiers property of any

> control you want to
> >access on form1 to Internal or Public. Make sure you

> pass a reference to
> >form1 into form2, then, for example, use the line:
> > form1.TextBox1.Text = "NewText";
> >Tom Clement
> >
> >"james ou" <(E-Mail Removed)> wrote in

> message
> >news:0bf401c3a386$d9ea1e10$(E-Mail Removed)...
> >> Hi,
> >>
> >> I create a form2 in the form1. Can I change some data
> >> of form1 in the form2?
> >>
> >> Thanks

> >
> >
> >.
> >



 
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
Modify form1 properties from form2 ( not access variable of form1 ) Boki Microsoft C# .NET 7 2nd Aug 2007 02:26 AM
Form2 DataGridView to Form2.. =?Utf-8?B?QWJkU29s?= Microsoft C# .NET 2 26th Apr 2005 08:30 AM
On form1 I instantiate form2 with a list box. I do I handle listboxclick from form1 PAPutzback Microsoft VB .NET 5 23rd Dec 2004 08:13 PM
Form2 open and Fill in Form1 panel, but Form2 "Activited" not functioning A-PK Microsoft Dot NET Framework Forms 0 19th Mar 2004 08:56 AM
Form1 open Form2, Form2 how to change text in Form1.label ? Tee Microsoft VB .NET 3 11th Mar 2004 09:49 AM


Features
 

Advertising
 

Newsgroups
 


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