Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 22nd, 2003, 08:48 AM
eyelevel eyelevel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 eyelevel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old October 22nd, 2003, 09:06 AM
Unkie Unkie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 32 Unkie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 27 sec
Reputation Power: 5
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

Reply With Quote
  #3  
Old October 22nd, 2003, 10:10 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Hi!eyelevel!Your code looks right!...Plz check your all detail in your code or manul operation(click or select).

Reply With Quote
  #4  
Old October 22nd, 2003, 10:35 AM
eyelevel eyelevel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 eyelevel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #5  
Old October 22nd, 2003, 11:09 AM
eyelevel eyelevel is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 eyelevel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #6  
Old October 22nd, 2003, 08:30 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > simple block-if statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT