|
-
Jun 7th, 2006, 04:19 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] using the underscore
hi all i was aware that you can use a underscore to continue routines onto another line does this work for if statments also? because i keep getting error a syntax when i try it
Last edited by Hack; Jun 8th, 2006 at 12:51 PM.
Reason: Added [RESOLVED] to thread title and green "resolved" checkmark
-
Jun 7th, 2006, 04:29 PM
#2
Re: using the underscore
It should be fine for any line of code, as long as you do it properly.
Show us what you have, and we'll fix it for you.
-
Jun 7th, 2006, 04:37 PM
#3
Re: using the underscore
If you find any issues to break and continue lines why don't you use the tools that will break lines and continue lines like MZ tools which is a free addin.
show us the example where you get errors?
-
Jun 7th, 2006, 05:05 PM
#4
Thread Starter
Fanatic Member
Re: using the underscore
alright i've got labels in a control array that i'm checking to see if they are not enabled ( now if there is an easier way than a if statment feel free to tell me the easier way as i'm just throwing this together quite quick and the coding may be a bit sloppy)
VB Code:
If Me.lblScore(1).Enabled = False and Me.lblScore(2).Enabled = False and Me.lblScore(3).Enabled = False and Me.lblScore(4).Enabled=False [COLOR=Red]_[/COLOR]
and me.lblscore(5).enabled =false
-
Jun 7th, 2006, 05:13 PM
#5
Re: using the underscore
that will work if you have 'Then' on the end 
you could use a loop:
VB Code:
Dim bAnyEnabled As Boolean
For N = lblScore.LBound To lblScore.UBound
If lblScore(N).Enabled Then bAnyEnabled = True: Exit For
Next N
If Not bAnyEnabled Then
'
'
'
Last edited by bushmobile; Jun 7th, 2006 at 05:16 PM.
-
Jun 7th, 2006, 05:40 PM
#6
Thread Starter
Fanatic Member
Re: using the underscore
ah ok what i was trying to avoid was to have such a large if statment ( as there is 13 lables) the loop also was an idea i didnt think of bust silly me i explained it wrong i was actually trying to check if ALL the controls are disabled
not just one at a time
-
Jun 7th, 2006, 05:58 PM
#7
Re: using the underscore
the code i posted will check if any of the labels are enabled - which is the same thing as checking that they are all disabled.
-
Jun 7th, 2006, 06:13 PM
#8
Thread Starter
Fanatic Member
Re: using the underscore
lol good point i modified it before realizing that i dont know where my logic is at 2 day
-
Jun 7th, 2006, 06:46 PM
#9
Thread Starter
Fanatic Member
Re: using the underscore
alright i dont know if i should post this in another thread or not if so just say the word and i will. in the program when the mouse moves over the lablels (lblscore)
it displays the score and when you click on it it disables the label. how can i have it so i cant click on more than one label in the array once i already clicked a label ?
-
Jun 7th, 2006, 06:52 PM
#10
Re: using the underscore
either set a form-level flag variable:
VB Code:
Private bNoClick As Boolean
Private Sub lblScore_Click(Index As Integer)
If bNoClick Then Exit Sub Else bNoClick = True
' Click Code
End Sub
or a static local variable:
VB Code:
Private Sub lblScore_Click(Index As Integer)
Static bNoClick As Boolean
If bNoClick Then Exit Sub Else bNoClick = True
' Click Code
End Sub
or do a check everytime:
VB Code:
Private Sub lblScore_Click(Index As Integer)
Dim N As Long
For N = lblScore.LBound To lblScore.UBound
If Not lblScore(N).Enabled Then Exit Sub
Next N
' Click Code
End Sub
there may be other ways too...
-
Jun 8th, 2006, 06:24 AM
#11
Thread Starter
Fanatic Member
Re: using the underscore
alright thanks sorry for the stupid questions i know there simple i just cant seem to think today one of those days...
-
Jun 8th, 2006, 11:12 AM
#12
Re: using the underscore
When you have received an answer to your question, please mark it as Resolved using the Thread Tools menu.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|