In a VB.Net 2017 Windows form application, so far I have only a splash form and a main form. When the user clicks a button on the splash form or a ten second timer fires (whichever occurs first) the splash form runs the AllDone() sub, which opens the main form and then closes itself. Here's the relevant code in the splash form:
Here's the relevant code in the main form:Code:Private Sub AllDone() Timer1.Enabled = False frmMain.Show() Me.Close() End Sub
Conn and ConnString are defined in a separate module as follows:Code:Imports System.Data.SqlClient ... Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'display version information Me.Text = "Referral Tracking - Version " & My.Application.Info.Version.ToString 'open database connection Conn.ConnectionString = ConnString Conn.Open() MsgBox("Connection State: " & Conn.State) End Sub
I've used this approach successfully in other projects. But in this particular project, it doesn't work. When frmMain_Load() runs, only its first two statements execute, then execution returns to AllDone() and the remaining two statements in frmMain_Load() never execute. No error is raised and the connection is not actually opened.Code:Imports System.Data.SqlClient ... Public Conn As SqlConnection = New SqlConnection Public ConnString As String = "[actual connection string]"
What am I doing wrong?




Reply With Quote
