How to read a variable from another form

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

I have a main form frmMain and second form frmMember,

I declare a variable at the top of the frmMember as
Dim memberStr as String


In the main form,

Dim MemberForm as frmMember

MemberForm = new frmMember()

if MemberForm.ShowDialog...... = .. then
' I want to read the variable of the memberStr in MemberForm

end if
 
Alan said:
I have a main form frmMain and second form frmMember,

I declare a variable at the top of the frmMember as
Dim memberStr as String


In the main form,

Dim MemberForm as frmMember

MemberForm = new frmMember()

if MemberForm.ShowDialog...... = .. then
' I want to read the variable of the memberStr in MemberForm

end if
If I'm understanding you correctly, dim memberStr as Protected Friend or
Public, then you can simply reference the variable as MemberForm.memberStr


HTH
Sueffel
 
I tried to refer this variable by :

if MemberForm.ShowDialog...... = .. then
' I want to read the variable of the memberStr in MemberForm
MemberForm.....
end if

The problem is the intellisense did not show up the variable name.
 
Alan said:
I tried to refer this variable by :

if MemberForm.ShowDialog...... = .. then
' I want to read the variable of the memberStr in MemberForm
MemberForm.....
end if

The problem is the intellisense did not show up the variable name.

Did you declare memberStr as Public or Friend meanwhile?
 
I just declare it as :
Dim memberStr as String
at the top of the frmMember.

What keyword should I use in order to used used by other form ?
 
Alan said:
I just declare it as :
Dim memberStr as String
at the top of the frmMember.

What keyword should I use in order to used used by other form ?

As Jo, Sueffel and I wrote:

Public memberStr as String
 
Back
Top