Results 1 to 2 of 2

Thread: [RESOLVED] confirmation on how to load form

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2008
    Posts
    22

    Resolved [RESOLVED] confirmation on how to load form

    Loading a form is the easiest thing to do. Unfortunately with the 2008 version, I keep running into new problems. Now, my forms will not load when I run and click the main form button, yet they used to work, so, I am therefore, seriously baffled. I'm hoping I just forgot to put in some code. So anyone who reads this post, please enter in the proper code for loading a form. such as for forms 1, 2, 3 and 4. 1 is the main form, and 2, 3, and 4 are the other forms. also if there is a loading procedure on the other forms, please note those two. Here below is my code. Enjoy.

    Option Explicit On
    Public Class Form1

    'Route User to the desired pagePrivate Sub
    Private Sub btncustomerservice_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btncustomerservice.Click
    Dim Click As Boolean
    If Click = True Then
    Customer_Service_Site.BringToFront()
    Customer_Service_Site.Show()
    ElseIf Click = False Then
    Customer_Service_Site.SendToBack()
    Customer_Service_Site.Hide()
    End If
    Click = False
    End Sub
    Private Sub btnhiring_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnhiring.Click
    Dim Click As Boolean
    If Click = True Then
    Hiring_Site.BringToFront()
    Hiring_Site.Show()
    ElseIf Click = False Then
    Hiring_Site.SendToBack()
    Hiring_Site.Hide()
    End If

    End Sub
    Private Sub btnemployee_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btncustomerservice.Click
    Dim Click As Boolean
    If Click = True Then
    Employee_Site.BringToFront()
    Employee_Site.Show()
    ElseIf Click = False Then
    Employee_Site.SendToBack()
    Employee_Site.Hide()
    End If

    End Sub



    End Class

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: confirmation on how to load form

    I dont understand your code where you put;
    Code:
    Private Sub btncustomerservice_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btncustomerservice.Click
        Dim Click As Boolean
        If Click = True Then
            'Do something
        ElseIf Click = False Then
            'Do something else
        End If
        Click = False
    End Sub
    You define a Boolean called Click in the ClickEvent? I assume this is meant to toggle the form between two states. In which case the "Click" variable needs to be defined at Class level.


    Code:
    Dim Click As Boolean = False
    
    Private Sub btncustomerservice_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btncustomerservice.Click
        If Click Then
            'Do something
        Else
            'Do something else
        End If
        Click = Not Click
    End Sub
    If you want to do this for each button, you will need several Click variables, one per button.

    So it would be easier to do something like;

    Code:
    Private Sub btnhiring_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnhiring.Click
        Hiring_Site.Visible = Not Hiring_Site.Visible
    End Sub
    Last edited by Bulldog; Feb 26th, 2009 at 04:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width