Hi,
I got
No accessible 'Main' method with an appropriate signature was found in '...'.
error when I added a sub main() to my vb.net win app.
I started building my forms without sub main(). It has this sub New()
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
cboSearchType.SelectedIndex = 0
LoadGrid_byCSR()
End Sub
Now I want to add a log in form. I followed a sample code that used a sub main()
Public Sub Main()
' Display the login dialog.
Dim dlg As New frmLogin
If dlg.ShowDialog() = DialogResult.OK Then
' The user correctly logged in.
' Display the main form.
Dim frm As New frmMain
frm.ShowDialog()
End If
End Sub
FrmLogin runs fine on its own, and I have set the project to start with sub main().
I also triedthis
Public shared sub Main()
That got me following error:
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Can a sub New and sub main co-exist? What did I do wrong? Thanks!