Parent/Owner Form Variable Value?

B

Bruce D

I have a form that opens up with my application. It acts as the main menu.
Let's just say it looks like this:

Public Class frmStartup
' some other settings
Public UserID As Integer = 0
' a bunch of functions and subs
End Class

Now let's say I have a button click on this form that calls another page
like so (still open in background)
Dim frmBarcode As New frmScan
frmBarcode.ShowDialog(Me)
frmBarcode = Nothing

And let's say the onlything on this new form is another button that calls
yet another page...like so:
Dim frmShowToUser As New frmXX
frmShowToUser.ShowDialog(Me)
frmShowToUser = Nothing

My question is if I'm on this last form and I put a button on it...how do I
print out the value of UserID from two forms prior? If I debug the form I
can see the owner.owner.UserID property and it's correct...but how can I
display it. Because I tried:
msgbox(me.owner.owner.UserID)
and it won't let me compile with error: "userid is not a member of
system.windows.forms.form

Any ideas?

-bruce
 
I

Imran Koradia

MessageBox.Show(DirectCast(Me.Owner.Owner, frmStartup).UserID)

Is this what you are looking for?

Imran.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top