Charles Baldo
asked on
c# Winforms: How to read a value form another form
Hi
New to c# Winforms. I have a menu form that has a combox control on it. When I open up a form from that menu form, how can I read the value in the Menu Form on the form I just open up?
So I have in the menu form
MenuDesigner.cs
this.RecordType = new System.Windows.Forms.Combo Box();
Menu.cs
getContributions frm = new getContributions();
frm.ShowDialog();
Thanks
then in my
New to c# Winforms. I have a menu form that has a combox control on it. When I open up a form from that menu form, how can I read the value in the Menu Form on the form I just open up?
So I have in the menu form
MenuDesigner.cs
this.RecordType = new System.Windows.Forms.Combo
Menu.cs
getContributions frm = new getContributions();
frm.ShowDialog();
Thanks
then in my
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Everyone learned a bunch and used anarkis solution
public string GetSelectedItemValueFromCo
{
return mycombo.SelectedItem.ToStr
}
Sometimes it does make sense to set some values on a child form before displaying it (and not passing parent's reference to constructor). However, don't make child's controls public - create set properties or methods instead.