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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using "With/End With". (VB6 is fighting back) 1

Status
Not open for further replies.

voydangel

Programmer
Dec 10, 2004
18
0
0
US
Apparently my brain stopped....why isnt this working?
(I have removed code so as to make this post not hundreds od lines long. to the best of my knowledge, the removed code shouldn't affect the outcome)

dim conceal as integer

<frmStart Code>

Private Sub Option1_Click(Index As Integer)
Select Case Index
Case 0
conceal = 8
End Select
End Sub

Private Sub cmdNext_Click()
Me.Hide
Update
frmMain.Show
End Sub


<modMain Code>

Public Sub Update()
With frmMain
.txtConceal.Text = conceal
End With
End Sub

Shouldn't "frmMain.txtConceal.Text" on frmMain be "8"? Its not! (Its Blank) Why?!?! (Using VB 6)
 
After review, i think the problem may lie in the "Option1_Click" section of my code...am i mis-using this? (its 2AM, so my brain is fried...help!) =)
 
If you want to use conceal as a Public variable you need to declare it in a code module , or within a Form module as Public. If not it won't be visible across forms.

Public conceal As Integer

If that is in a Code Module it will be visible anywhere, if it's within the frmStart Form module it's only visible as :
frmStart.conceal

________________________________________________________________
If you want to get 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?'

for steam enthusiasts
 
Thanks, that was it....apparently its time for bed...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top