Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Application Launch Conditions

Status
Not open for further replies.

tEkHEd

IS-IT--Management
Jan 29, 2003
261
GB
Hi there..

I am trying to set some launch conditions in a windows form and if the conditions are false automatically close the form.

I thought that i could use something like:

Code:
    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()
        Me.Show()
        'Add any initialization after the InitializeComponent() call
        Dim t As Boolean = False

        If t <> True Then Me.Close()

    End Sub

This however just pops up my form and then hangs (I can't close the form by clicking on the X in the control box)

Can anyone think of a way that I can verify certain criteria within the form that will automatically close if not met?

Thanks in adv..
 
Ok I kind of solved this in a dirty way.. I basically created a new module, put the launch conditions in the sub main of the module as following:

Code:
Sub main()

        If EnsureConfig() Then
            Dim f As Form = New Splash
            f.ShowDialog()
        End If

    End Sub

this works ok, but would still like to understand if this action can be carried out within the same class??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top