Results 1 to 3 of 3

Thread: How to start this app?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    How to start this app?

    I have a method in a class that is reading an authority database... and depending on what kind of auth-class it find I want to open a certain form in my windows app... My problem is that I have no clue what I should use as startup point?

    I have forms 1 2 and 3. Let's say I add the check-method in form_load in form 1. It discovers that it should only show form 2. Then I have to close form 1 and never load form 3...


    I load forms with

    dim myAdminform as new AdminForm

    ....
    ...

    Am I going on about it the wrong way? Im used to asp.net development

    kind regards
    Henrik

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You should be starting from a Sub Main which checks the type and loads just only the one form that is needed. Sub Main can be in a class or a Module and set it as the start point from the project properties. You also have to show the form modally or call Application.Run after it so the application knows to stay open. Something like this:
    VB Code:
    1. Public Module StartUp
    2.  
    3.    Public Sub Main()
    4.  
    5.        Dim auth As String=GetAuthClass
    6.        Select Case auth
    7.          Case "Admin"
    8.                Application.Run(New frmHighLevel)
    9.           Case "Other"
    10.                Application.Run(New frmMidLevel)
    11.           Case Else
    12.                Application.Run(New frmLowLevel)
    13.        End Select
    14.  
    15.    End Sub
    16.  
    17. End Module

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    Shame on me, I found out this by myself about 5 minutes after posting it... well now others can share the answer anyway

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