05-19-2006 01:52 AM
![]() |
I am trying to pass visa namespace between forms and I am really stuck! I cannot figure out why I can see the mainform property from the other form. Can someone give me a shove in the right direction, Please? Here is some psuedo code:namespace instcontrol class mainform Public ReadOnly Property OpenedSession() As NationalInstruments.VisaNS.MessageBasedSession Private Sub btnOpenSession() Private Sub btnOtherForm() End Class Class OtherForm Private Sub OtherForm_Load() End Class End Property |
05-22-2006 01:28 PM
05-23-2006 02:55 AM
I did find another way to do it, and after seeing your example it all made perfect sense to this poor old vb6 programmer 🙂
I did it my way comes to mind here, but your way is much simpler and elegant.
My Way:
Class Main
Public ReadOnly Property OpenedSession() As NationalInstruments.VisaNS.MessageBasedSession
Get
Return mbSession
End Get
End Property
Private Sub btnBrowseVisaNS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseVisaNS.Click
Dim BrowseVisaNS As BrowseVisaNSForm = New BrowseVisaNSForm
BrowseVisaNS.Owner = Me
BrowseVisaNS.ShowDialog()
End Sub
End Class
Class BrowseVisaNS
Dim mbsession As MainForm
Private Sub BrowseVisaNS_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
mbsession = Me.Owner
If Not (mbsession.OpenedSession Is Nothing) Then
PopulateSessionTreeView()
Else
Me.Close()
End If
End Sub
End Class
Your Way:
.ShowDialog(Me)
Much less typing 🙂
Thanks for pointing me in the right direction with that one, I would have wandered around aimlessly for days before figuring it out!
05-23-2006 10:04 AM