Dimming a large Statement....

Discussion in 'Visual Basic ( VB )' started by Ches, Feb 1, 2007.

  1. Ches

    Ches New Member

    Joined:
    Jan 31, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    OK So I'm in a small rut in one of my programs...... I don't know if it even can be done, but I'd like to know how to state coding in a massive dim........Such as like

    Dim BigIF as ????(<-What do I call this if it can be done/can it even be done in dim?)

    BigIF=If this0 then If this1 then If this2 then If this3 then If this4 then If this then Do this.

    In truth, It isn't neccessary(because i could just re-write the coding), it will just save me about 50 lines of coding.....
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I could not get what you are asking. Are you talking about the array of longs?
     
  3. Ches

    Ches New Member

    Joined:
    Jan 31, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    OK what I mean is to take a formula (such as: if y>1 and x<1 and z=1 then Q.caption="1")
    and dim it as a variable....Long(as far as I understand it) Won't allow me to use coding statements such as if/then/else....and thats what i need to use.........
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Still I am not sure but whatever condition you wish you can give? if y>1 and x<1 and z=1 then Q.caption="1" is very much possible.

    Also dimming inside the ifs is also possible.
     
  5. Ches

    Ches New Member

    Joined:
    Jan 31, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    I Was just wondering what statement you should use to dim the total statements:[ if y>1 and x<1 and z=1 then Q.caption="1"] and call it by a name such as : Bob
    OK..I'll try to explain a little better....

    I want to say somethign like
    dim water as ?? (i don't know what its called)
    water= { if y>1 and x<1 and z=1 then Q.caption="1"}
    so i can use it like this....
    If label1="32" then Water
    and it will put the statement called "water" where the word ( "water" ) is used.....
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Nope that is not possible in VB as far as I know but I am not a VB expert. What you are saying are something like macros in C++
     
  7. Ches

    Ches New Member

    Joined:
    Jan 31, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Ok thank you ......
    Another question i Have is .....
    I have an imagebox...I want you to have a list of options for what to do with this item(thats in the imagebox) come down when you right click(Which i'm assuming is the dblclikc option....)...How could i do that or something similar to it.....?


    Thanks


    *Ches
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I am not sure what you mean by image box? Use a menu to give user the options to select something.
     
  9. riffz

    riffz New Member

    Joined:
    Apr 7, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Canada
    Are you saying that you want to use that long IF code constantly throughout your program? If so, put it in a private sub, then just call it when you want to use that code. So...

    Code:
    'declare sub
    private sub water()
    
    'put if code here
    if y>1 and x<1 and z=1 then Q.caption="1"
    
    end sub

    Then whenever you want to use that code, just call the sub:

    Code:
    call water()
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice