Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redundant?
#1
Code:
Private Sub chkServerLog_Click()
    ' if its not 0, then its true
    If Not chkServerLog.Value Then
        ServerLog = True
    Else
        ServerLog = False
    End If
End Sub

Wouldn't it be simpler to just see if it's checked, rather than toggle a boolean when it's checked? Rather than seeing if the ServerLog = True or false, why not just have it as

Code:
If frmserver.chkserverlog.value = 1 Then
DoCode

Am I missing something obvious?
Reply
#2
It's less code in the long run, if you think about it. I'd rather just check a single boolean (I prefer to use a byte..) than have to type all that out each time.
Reply
#3
Less code in vb6 doesn't actually mean its faster. But really, it will make such an insignificant difference. Just ignore it.
Reply
#4
Who said anything about speed? I'm just lazy. Lol.
Reply
#5
Hmmm. Alright, just trying to learn good habits for programming. Figured, I'd ask you guys. Thanks!
Reply
#6
You know to reduce that to a single line?

Code:
Private Sub chkServerLog_Click()
    ' if its not 0, then its true
    ServerLog = Not chkServerLog.Value
End Sub
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)