VS 2008 forms + multiple-VBForums
Results 1 to 5 of 5

Thread: forms + multiple

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    86

    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

  2. #2
    Frenzied Member CoachBarker's Avatar
    Join Date
    Aug 2007
    Location
    Central NY State
    Posts
    1,079

    Re: forms + multiple

    Have you checked the Code Banks here in the VB.net forums, lots of examples there.
    Thanks
    CoachBarker

    Code Bank Contribution
    Login/Manage Users/Navigate Records: http://www.vbforums.com/showthread.php?t=572936
    ] VB.net [/url]|http://www.vbforums.com/showthread.php?t=572960
    ] C# [/url]

    Helpful Links: VB.net Tutorial | C Sharp Tutorial | http://www.w3schools.com/sql/default.asp]SQL Basics[/url]

  3. #3
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    476

    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.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    86

    Re: forms + multiple

    Quote Originally Posted by CoachBarker View Post
    Have you checked the Code Banks here in the VB.net forums, lots of examples there.
    any particularly I should look at?

  5. #5
    Member Coke Vanilla's Avatar
    Join Date
    Dec 2009
    Posts
    32

    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.