Groups | Blog | Home
all groups > c# > july 2003 >

c# : Quick help w/ Properties



Doug
7/21/2003 9:48:04 PM
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

--
Ignacio Machin
7/22/2003 8:52:53 AM
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

[quoted text, click to view]

AddThis Social Bookmark Button