-
VB6 vs VB.Net
I've been programming in VB 6 for about 3 years and think I am pretty good at most things in it. However, this VB .NET is working my last nerve. The help topics and MS website is awful and all of the coding has changed.
What I am struggling with now is showing a form after the splash screen which took me a while to figure out in .Net
Form.load
Form.show
naturally doesn't work anymore.
I've tried the following also:
Dim frmname as new form
frmname.show
However, it doesn't display the form I have named frmname.vb.
Is there any books or sites anyone knows of where you can enter a VB6 command and have it return the VB.net syntax.
This is getting very frustrating so any help would be greatly appreciated.
Thanks in advance....
-
Don't know of any sites...but here is how you do it, you almost had it.
Dim frm as new frmName()
frm.show()
-
Just a little more...
I think that the hardest thing for VB6 and earlier programmers with .Net is that it is truly OO. Everything is an object. Just remember, objects don't exist unless you create them...and you create them from classes.
In the example of the form....You are designing a form in the IDE, but it is just a class in which you can create objects from. It doesn't exist...until you create it.
When you do this:
Dim frmTemp as Form
You are just creating a generic form from the form class. If you want to get specific on what kind of form...such as a class you created in the IDE, you will need to make an object of that type. Hence this:
Dim frmTemp as MyIDECreatedForm
-
I found the best way to do this is to start the app in the frm_main and hide the display on start up. Then fire the splash screen as well as do any back ground processing. I used a timer and a state to keep checking the state of the start-up. It is some work but believe me there don't seem to be any suitable solutions.
Place a timer on the form , enable it and set the inteval to say 100
'Structures and enumeration
Private Enum EN_STATE
Starting
Initializing
Log_On
Complete
End Enum
Private frmSplash As New frm_splash() 'Splash Screen
Private State As EN_STATE = EN_STATE.Starting 'Start-up state
Private Sub frm_main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Hide()
End Sub
'Start Up Timer - Launches the splash screen and completes initialization
Private Sub Timer_System_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_System.Tick
Timer_System.Enabled = False
Select Case State
Case EN_STATE.Starting 'Initial State on Startup
frmSplash.Show() 'Launch the splash screen
Timer_System.Interval = 2000 'Minimium splash screen time
State = EN_STATE.Initializing 'Initialization in progress
Timer_System.Enabled = True 'Restart the timer
IniSystem() 'Initialise the system
State = EN_STATE.Complete 'Change State when initialization complete
Case EN_STATE.Initializing 'Initialization not complete so wait
Timer_System.Interval = 500
Timer_System.Enabled = True
Case EN_STATE.Complete 'Initialization Complete
frmSplash.Close() 'Close splash screen
If AvSystem.blnInitialized Then
Me.Show() 'Launch the main program
State = EN_STATE.Log_On 'Force the user to logon
Timer_System.Interval = 100 'Restart the timer
Timer_System.Enabled = True
Else
MsgBox("AvMacs Initialization Failed.", MsgBoxStyle.Critical, "System Manager")
Application.Exit() 'Exit the main program
End If
Case EN_STATE.Log_On 'Initialization Complete
LogOnApp() 'App log-on dialog box
End Select
End Sub