Following your guidelines, I now have;
Module Main
Public Sub main()
Dim myFormStartup As New StartUp
Application.Run(myFormStartup)
End Sub
Class Startup
Dim myFormHardware As Hardware_Store
Dim myFormHardwareStatus As Boolean
Private Sub StartUp_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
myFormHardwareStatus = False
End Sub
Private Sub StartUp_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
myFormHardwareStatus = False
myFormHardware = New Hardware_Store
myFormHardware.Show()
End Sub
Public Function getMyFormHardwareStatus() As Boolean
Return myFormHardwareStatus
End Function
Public Sub setMyFormHardwareStatus(ByVal Status As Boolean)
myFormHardwareStatus = Status
End Sub
Class HardwareStore
Private Sub Hardware_Store_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
' This line is where I'm having the problem
' The error says MyFormStartup is not declared
myFormStartup.setMyFormHardwareStatus(True)
End Sub
The problem is trying to reference a function or sub in the myFormStartup
that I instantiated in the sub Main().
What am I missing to be able to access a function in myFormStartup?
Thanks,
Bernie
"AlanT" <al*******@users.com> wrote in news:1144283866.510955.33080
@i39g2000cwa.googlegroups.com:
You really don't have two forms. You have a form class 'HardwareStore'
and an instance of that class 'myForm'.
When setting a startup object you would select HardwareStore and the
runtime will generate an instance of it and display that instance. You
need to explictly create and show the form.
Depending upon where the lines above are placed either they will never
be run or you may have two instances of HardwareStore showing.
There are a few different ways to start a VB.Net application.
For a simple start.
Define the HardwareStore form. Mark it as your startup object. Run the
application and it will show.
For a more complicated start.
Create a module, say HardwareLoader, and put a sub main() in it
Module HardwareLoader
public sub main(args() as string)
Dim mainForm as new HardwareStore
Application.Run(mainForm)
end sub
end module
Set HardwareLoader as the startup object. Run application.
hth,
Alan.