Home All Groups Group Topic Archive Search About

Passing a value to a form

Author
19 May 2009 8:21 PM
Rich
I am using VB6.

Years ago, I passed a value to a form. For the life of me, I don't
remember how I did it.

I could use property get or let. Or use the user defined Type object.

I would prefer just to open up the form and pass it a value. How to do
this?

Author
19 May 2009 8:34 PM
Nobody
"Rich" <richma***@earthlink.net> wrote in message
news:18feaec1-35b9-4cc8-80fa-1cde2dee9bdd@z19g2000vbz.googlegroups.com...
>
> I am using VB6.
>
> Years ago, I passed a value to a form. For the life of me, I don't
> remember how I did it.
>
> I could use property get or let. Or use the user defined Type object.
>
> I would prefer just to open up the form and pass it a value. How to do
> this?

Public Sub ShowMe(ByVal Param1 As String)
    Me.Show vbModal
End Sub
Author
19 May 2009 8:56 PM
Nobody
Show quote Hide quote
"Nobody" <nob***@nobody.com> wrote in message
news:ehO$GFM2JHA.2656@TK2MSFTNGP05.phx.gbl...
> "Rich" <richma***@earthlink.net> wrote in message
> news:18feaec1-35b9-4cc8-80fa-1cde2dee9bdd@z19g2000vbz.googlegroups.com...
>>
>> I am using VB6.
>>
>> Years ago, I passed a value to a form. For the life of me, I don't
>> remember how I did it.
>>
>> I could use property get or let. Or use the user defined Type object.
>>
>> I would prefer just to open up the form and pass it a value. How to do
>> this?
>
> Public Sub ShowMe(ByVal Param1 As String)
>    Me.Show vbModal
> End Sub

Or:

Private m_sPassword As String

Public Function GetPassword() As String
    m_sPassword  = ""
    Me.Show vbModal
    GetPassword = m_sPassword
End Sub

Private Sub btnOK_Click()
    m_sPassword = txtPassword.Text
End Sub
Author
20 May 2009 2:14 PM
Saga
Aside from Nobody's solution I have also used properties, just
like you mentioned. Either way works ok. Saga


Show quoteHide quote
"Rich" <richma***@earthlink.net> wrote in message
news:18feaec1-35b9-4cc8-80fa-1cde2dee9bdd@z19g2000vbz.googlegroups.com...
>
> I am using VB6.
>
> Years ago, I passed a value to a form. For the life of me, I don't
> remember how I did it.
>
> I could use property get or let. Or use the user defined Type object.
>
> I would prefer just to open up the form and pass it a value. How to do
> this?
Author
20 May 2009 2:50 PM
Jeff Johnson
"Rich" <richma***@earthlink.net> wrote in message
news:18feaec1-35b9-4cc8-80fa-1cde2dee9bdd@z19g2000vbz.googlegroups.com...

> I am using VB6.
>
> Years ago, I passed a value to a form. For the life of me, I don't
> remember how I did it.
>
> I could use property get or let. Or use the user defined Type object.
>
> I would prefer just to open up the form and pass it a value. How to do
> this?

I just want to clarify: without explictly adding a property or a method,
there is no way to pass a value to a form*. In Access there is the concept
of passing arguments when opening a form; there is no such thing in VB.



*Yes, pedants, you could set one of the built-in properties, like Tag, but
you can't REACT to that value being set, which is what I assume the poster
wants.