Quick help w/ Properties

  • Thread starter Thread starter Doug
  • Start date Start date
D

Doug

Hello,

Can someone help me quickly w/ properties.

I have 2 forms (say Form1 and Form2). When a user enters a value on Form1
I want to make it available to Form2. I declared a public property on
Form2 and on Form1 set the property (declared on Form2) to the value then
tried to use it on Form2. This isn't working...see code below.

Form2....
private DateTime startDateTime;

public DateTime StartDateTime
{
get
{
return startDateTime;
}
set
{
startDateTime = value;
}
}

Form1...
private DateTime Time;
Form2.StartDateTime = Time;


But this does not work, I don't get the value that I entered. If I declare
and set the property in Form1, it works perfectly. What am I doing wrong?
Thanks in advance....

Doug
 
Hi Doug,

That shoudl works fine if Form2 is ShowDialog'ed
Are you sure that you are assigning the value entered to the form2
property?

Cheers,
 
Back
Top