View Single Post
Old Mar 8th, 2007, 11:36 AM   #4
milot
Programmer
 
milot's Avatar
 
Join Date: Nov 2006
Location: Kosovė/Prishtinė
Posts: 47
Rep Power: 0 milot is on a distinguished road
Hi,

I don't know Visual Basic but it's the same like in C#, so in C# I do something like shown below:

CSharp Syntax (Toggle Plain Text)
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. Form2 form_var = new Form2();
  4. form_var.Show();
  5. //form_var.ShowDialog();
  6. }

and I converted the above code to VB.NET using developerfusion utility http://www.developerfusion.co.uk/uti...sharptovb.aspx to make the conversion and the VB code should look like below:

vbnet Syntax (Toggle Plain Text)
  1. Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
  2. Dim form_var As Form2 = New Form2
  3. form_var.Show
  4. 'form_var.ShowDialog
  5. End Sub

As you can see I have commented .ShowDialog() method. With the .Show() method we can manipulate with two opened forms we can minimize Form1 work with Form2 or opposite, but when we use .ShowDialog() method, we cannot work in Form1 while the Form2 is shown, it is like a MessageBox we should close Form2 and continue working with Form1. But keep in mind, in our case here Form2 is child form of the Form1, so if you are using .Show dialog and if you close Form1 the Form2 will close.

If you have further questions, or I didn't express so good, post a reply we hare here for this reason to help each other .
milot is offline   Reply With Quote