Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Basic 6 return parameter from form

Status
Not open for further replies.

ljpitre

Programmer
Sep 14, 2007
5
US
Is there a way to return a value from a form in Visual Basic 6?
 
'In the Form1 module:
Option Explicit
Public mSomeVariable as Long
Private Sub Form_Initialize()
mSomeVariable =123
End Sub

'Then:
x = Form1.mSomeVariable

=======================================

'Or the more encapsulated method:

Option Explicit
Private mSomeVariable as Long

Private Sub Form_Initialize()
mSomeVariable =123
End Sub

Property Get SomeVariable() As Long
SomeVariable = mSomeVariable
End Property

Property Let SomeVariable(lData As Long)
mSomeVariable = lData
End Property

'Then:
x = Form1.SomeVariable
 

You might also want to consider responding to your other threads as well, or it may affect repsonses to your future threads, as JoeAtWork has mentioned to you before, and it helps others when they see what worked for you.

You can do this per post, or by marking the helpful post by clicking on "Thank [Handle] for this valuable post!", which is located at the bottom left of each post.
 

I pointed OP to faq222-2244 in his first thread on this forum, but he still hasn't responded.

I guess either our answers are all useless - or maybe OP doesn't care as long as he gets his answer! [smile]

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top