|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
simple block-if statement
This is driving me crazy! The two main variables in this code are minimum and maximum, in a drop-down list box. But it only seems to recognize maximum.
If Val(Combo1.Text) = minimum Then If Check1.Value = 1 And Option1.Value = True Then Text1 = 50 - 25 ElseIf Check1.Value = 0 And Option1.Value = True Then Text1 = 50 End If End If If Val(Combo1.Text) = maximum Then If Check1.Value = 1 And Option1.Value = True Then Text1 = 100 - 25 ElseIf Check1.Value = 0 And Option1.Value = True Then Text1 = 100 End If End If If I select minimum then check checkbox1 and option1 then textbox1 should = 25 but I always get the result of 75. Which is result if I select maximum. Any ideas? |
|
#2
|
|||
|
|||
|
the first part does it ok, the second overwrites the first part
val(Combo1.Text) seems to be equal to minimum and maximum, one way or another, there's something spooky with your vars in the boxes or min/max |
|
#3
|
|||
|
|||
|
Hi!eyelevel!Your code looks right!...Plz check your all detail in your code or manul operation(click or select).
|
|
#4
|
|||
|
|||
|
Thanks for replying so fast! I agree minimum and maximum are being viewed as the same thing, but me nor my teacher(who has been programming in the biz for 30 years and teaching for 10) cant figure out what exactly the deal is.
|
|
#5
|
|||
|
|||
|
I finally solved it! Instead of using: val(combo1.text) = minimum, I used: combo1.listindex = 0(for minimum) and 1(for maximum). What a great feeling it is to finish an application!
|
|
#6
|
|||
|
|||
|
I think u will use "Clng" or "Cint" function to replace the "val" function...Because "Val" function return a variable type value,is not a fixed type value.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > simple block-if statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|