showing form

urvi_bhal

Member
Joined
Jun 29, 2005
Messages
14
Programming Experience
Beginner
hi,
my module code is like this..

Public cn As New System.Data.SqlClient.SqlConnection()
Public cm As New System.Data.SqlClient.SqlCommand()
Public dr As SqlClient.SqlDataReader
Friend fuser As frmUser
Friend fRoot As frmRoot

Public Sub main()
Dim frmsplash As New frmSplash()
Dim frmRRegister As New frmRootRegister()
Dim frmR As New frmRoot()
frmsplash.Show()
Application.DoEvents()
System.Threading.Thread.Sleep(3000)
frmsplash.Close()
Try
openconnection()
cm.Connection = cn
cm.CommandType = CommandType.Text
cm.CommandText = "Select * from ARootTable"
dr = cm.ExecuteReader
If dr.Read Then
Application.Run(frmR)
Else
Application.Run(frmRRegister)
End If
Catch e As Exception
MsgBox(e.Message)
cn.Close()
cm.Dispose()
dr.Close()
Finally
cn.Close()
cm.Dispose()
dr.Close()
End Try
Exit Sub
End Sub

after application.run(frmR) i am redirecting frmR to new form
but the form is shown for a while then it disappears and coming back to application.run(frmR) then application is closed what can be problem?
 
is there any code in frmR that is called that would close the form?

also when posting code it's better if it's placed inside the [ code ] and [ /code ] tags as it's easier to read
 
Back
Top