I'm having trouble passing data between forms. Before you shout, I know there are many threads about this topic already but none seem to work for me.
basically form 1 is like this:-
Form abc = new PasswordResetFrm();
abc.userName = "Fred";
abc.ShowDialog(this);
in form 2 (PasswordResetFrm) I have a property as followe:-
public string userName
{
get
{
return txtUser.Text;
}
set
{
userName = txtUser.Text;
}
}
The problem is this, I cannot see the property userName in form1. In fact I cannot see anything I add as public in the 2nd form. I can't even see a textbox on the 2nd form if I change 'modifiers' property to public.
The form displays correctly. I can change main properties of the 2nd form before showing i.e. the displayed form name (text property). I just can't see anything I've added.
Both forms are in the same project and namespace.
It's as if it's missing some references.
If I try to compile the program I get the message 'System.Windows.Forms.Form' does not contain a definition for 'userName'.
By the way, I haven't tried passing the details in the constructor. I want to try and crack it the proper way and I also want to be able to get a result back from the 2nd form.
Can anyone help please.
Brian
basically form 1 is like this:-
Form abc = new PasswordResetFrm();
abc.userName = "Fred";
abc.ShowDialog(this);
in form 2 (PasswordResetFrm) I have a property as followe:-
public string userName
{
get
{
return txtUser.Text;
}
set
{
userName = txtUser.Text;
}
}
The problem is this, I cannot see the property userName in form1. In fact I cannot see anything I add as public in the 2nd form. I can't even see a textbox on the 2nd form if I change 'modifiers' property to public.
The form displays correctly. I can change main properties of the 2nd form before showing i.e. the displayed form name (text property). I just can't see anything I've added.
Both forms are in the same project and namespace.
It's as if it's missing some references.
If I try to compile the program I get the message 'System.Windows.Forms.Form' does not contain a definition for 'userName'.
By the way, I haven't tried passing the details in the constructor. I want to try and crack it the proper way and I also want to be able to get a result back from the 2nd form.
Can anyone help please.
Brian