Multiple Forms - Modal

  • Thread starter Thread starter Ernie
  • Start date Start date
E

Ernie

I have the following code in VB6:
(Form1)
Private Sub Command1_Click()
Form2.Show 1
End Sub

(Form2)
Private Sub Command1_Click()
Form2.Hide
End Sub

What is the .NET equivalent of this in C#.NET or VB.NET

Thank you in advance

Ernie
 
I have been able to do this using:

(Form1)

private void button1_Click(object sender, System.EventArgs e)
{
Form2 Form2 = new Form2();
Form2.ShowDialog();
}
(Form2)
private void button1_Click(object sender, System.EventArgs e)
{
this.Hide();
}

Is this the approach that has been adopted by the community?
 
Ernie said:
Is this the approach that has been adopted by the community?

I don't know that, but another thread has discussed
that hiding a modal form may not be well defined in
..NET. Maybe it is better to use "Close()" instead.
 
Back
Top