Oct 17th, 2012, 02:09 AM
#1
Thread Starter
Junior Member
some logic of begginers
hi all
its me , the novice programmer.
see this on off light bulb .
Attached Files
Oct 17th, 2012, 06:43 AM
#2
Re: some logic of begginers
Nice work, but here is a compact and easy to understand code
Code:
Option Explicit
Private mblnMainSwitch As Boolean
Private mblnLightSwitch As Boolean
Private Sub Form_Load()
mblnMainSwitch = False
mblnLightSwitch = False
SetLight
End Sub
Private Sub Command1_Click()
mblnMainSwitch = Not mblnMainSwitch
SetLight
End Sub
Private Sub Command2_Click()
mblnLightSwitch = Not mblnLightSwitch
SetLight
End Sub
Private Sub SetLight()
Command1.BackColor = IIf(mblnMainSwitch, vbYellow, vbWhite)
Command1.Caption = "Main Switch " & IIf(mblnMainSwitch, "ON", "OFF")
Command2.BackColor = IIf(mblnLightSwitch, vbYellow, vbWhite)
Command2.Caption = "Light Switch " & IIf(mblnLightSwitch, "ON", "OFF")
Image1.Picture = IIf(mblnMainSwitch And mblnLightSwitch, LoadPicture(App.Path & "\" & "on.jpg"), LoadPicture(App.Path & "\" & "off.jpg"))
End Sub
Oct 18th, 2012, 05:59 AM
#3
Thread Starter
Junior Member
Re: some logic of begginers
Gee thanks
I am here for such "kind enlightenment".
Your post is equal for dozens of lessons for me.
I will be grateful if you have a glance at my other posts.
Oct 18th, 2012, 06:17 AM
#4
Re: some logic of begginers
I will be grateful if you have a glance at my other posts.
What post you are talking about?
Oct 18th, 2012, 08:36 AM
#5
Thread Starter
Junior Member
Re: some logic of begginers
Oh sorry it is one post not posts
http://www.vbforums.com/showthread.p...emo-simple-one
that if it is worthy and opens new opportunities for beginners like myself to learn how to handle code..I mean give it a slight push.
thank you
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