I have two forms a and b. there is a button on a that will hide a and show b. Then i want to go back to a without making a new instance. Also pass a an new vaule. how is this done code below
a
private void ShowAction_Click(object sender, EventArgs e)
{
SingleActionSelect SelectActionDisplay = new SingleActionSelect(StationDataTable); this.Hide();SelectActionDisplay.ShowDialog();
}
b
private void ActionSelect_Click(object sender, EventArgs e){
int index = ActionDisplay_listBox.IndexFromPoint(ActionDisplay_listBox.PointToClient(Cursor.Position)); Stationstatus showstationstats = new Stationstatus(); //check if any item was clicked if (index == -1){
return;}
ActionList = (
string)ActionDisplay_listBox.Items[index];ActionList = showstationstats.ActionName;
this.Close();}

Save Settings
Jim Douglas
NVM I got it
Thanks
PGriff
Rob Caldecott
Hi,
I am not sure what really your question is. But as I understand you have two forms form A and form B and you want to show form B on button click in from form A and then Show form A on button click from form B and also want to return some value back to form A. More you also want to keep the single instance of form A.
If am right then there are two ways you can do that…
Make form A singleton so that when ever you create new instance old instance will be return and you can easily create new instance and show it from form B.
Other way is pass A’s reference when you create new instance of form B, then from form B you can show and hide form A and also you can pass value e.g. create a variable in from A and then set its value from form B as form A’s instance is now accessible from form B.
Hope this help
villupuram