Chris
Mon Jul 18 09:24:16 CDT 2005
Here's a simple example that shows 2 ways: via contructor, or via Property:
class Form1 : Form
{
private Form2 m_form2;
public Form1() {...}
void ShowForm2(int myvar)
{
if(m_form2 == null)
{
m_form2 = new Form2(myvar);
}
else
{
m_form2.CustomVar = myvar;
}
m_form2.Show();
}
}
class Form2 : Form
{
private int m_myvar;
public Form2(int myvar)
{
m_myvar = myvar;
}
public int CustomVar
{
set { m_myvar = value; }
}
}
--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
"Rob G" <RobG@discussions.microsoft.com> wrote in message
news:9604789C-5440-4117-8FA1-C760BA9CF51F@microsoft.com...
> Chris I like your solution, can you point me to an example or very simple
> code sample if handy. I did some searching and could not find example.
>
> "Chris Tacke, eMVP" wrote:
>
>> Inheritance won't help you here. Add a ctor to the second form that
>> takes
>> the value you want to pass as a parameter.
>>
>> --
>> Chris Tacke
>> Co-founder
>> OpenNETCF.org
>> Are you using the SDF? Let's do a case study.
>> Email us at d c s @ o p e n n e t c f . c o m
>>
http://www.opennetcf.org/donate
>>
>>
>> "Rob G" <RobG@discussions.microsoft.com> wrote in message
>> news:78E782A4-25AB-4C08-8652-589C30E2CB0D@microsoft.com...
>> > Well I've been having a blast design a thin PPC client for my web
>> > application
>> > using mixture xml and webservices.
>> >
>> > Pardon my newbie quesiton but should be a easy one.
>> >
>> > My questions is I have two forms, one for "Login.cs" and "Main.cs".
>> > Because
>> > I'm a web developer, I'm not familiar how to pass a assigned UserID
>> > variable
>> > after capturing it in Login and being able to use it Main.cs I tried
>> > set/get
>> > and public methods, is the only way inheritence?
>> >
>> >
>>
>>
>>