Results 1 to 5 of 5

Thread: some logic of begginers

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2012
    Posts
    24

    some logic of begginers

    hi all
    its me , the novice programmer.
    see this on off light bulb .
    Attached Files Attached Files

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    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



  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2012
    Posts
    24

    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.

  4. #4
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: some logic of begginers

    I will be grateful if you have a glance at my other posts.
    What post you are talking about?



  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2012
    Posts
    24

    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
  •  



Click Here to Expand Forum to Full Width