-
May 8th, 2010, 03:21 PM
#1
Thread Starter
Lively Member
forms + multiple
Hello,
I am looking for some tutorial and/or general guidance on how to create a form on top of the main form and how to handle the actions (save settings for example).
In general I want to spawn a new form ontop of my main form and the main form cant be used anymore (greyed out) for that moment anymore.
How is this possible? tried google but only show me how to create basic forms.
Thanks in advance
- Blixia
-
May 8th, 2010, 04:00 PM
#2
Frenzied Member
Re: forms + multiple
Have you checked the Code Banks here in the VB.net forums, lots of examples there.
-
May 8th, 2010, 06:40 PM
#3
Hyperactive Member
Re: forms + multiple
If you want to disable the parent form then use the ShowDialog method.
http://msdn.microsoft.com/en-us/library/c7ykbedk.aspx
Such as
Code:
Dim f as Form = New Form1
f.ShowDialog
Prefix has no suffix, but suffix has a prefix.
-
May 8th, 2010, 06:43 PM
#4
Thread Starter
Lively Member
Re: forms + multiple
Originally Posted by CoachBarker
Have you checked the Code Banks here in the VB.net forums, lots of examples there.
any particularly I should look at?
-
May 8th, 2010, 09:16 PM
#5
Member
Re: forms + multiple
Okay, so say I am you for this example.
I create a new Windows Form Application. I have a new blank form and I'm ready to rock. To create a new form I go to the solution explorer and right click on the name of my project, for example if I just used VB's default name it would be WindowsApplication1, and I go down to Add > Windows Form. So now I have a Form1 and a Form2. I want to have Form1 be disabled when Form2 is up and it can only be enabled when Form2 is not up. Simple solution. Put a button or whatever control you will use to open Form2. I will use a button. When I click that button Form2 will open and Form1 will be disabled. When I close Form2 Form1 will be enabled. Say I name my button on Form1 btnOpen. Double click on btnOpen so that it's code will show. Enter this:
Code:
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Form2.Show()
Me.Enabled = False
End Sub
Now Form2 will show and Form1 will be disabled. Now we are going to reverse this code. Again I'm going to use a button to get the job done for me. I'm going to name my button on Form2 btnClose. Double click on btnClose so that it's code will show. Enter this:
Code:
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Form1.Enabled = True
Me.Close()
End Sub
And voila! I am done. When I click btnOpen Form1 will be disabled and Form2 will show. When I click btnClose Form2 will close and Form1 will be disabled.
I'm not sure what you mean when you say you want to save the settings though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|