|
-
Oct 9th, 2000, 12:59 AM
#1
Thread Starter
New Member
I've been writing a pretty simple application that involves the user entering three numbers into a pair of text boxes (Three numbers each) and the result label changing according to what's written in there... I've tried both Select Case and If statements (An example of the code follows), but I get the same problem: On some (About 30%) combinations of numbers, instead of the result that's written for that combination I get a result for an entirely different combination! Here's an example of the code in Select Case and If:
If TxtBoxone = 111 And TxtBoxtwo = 222 Then
LblTheResult = "Whatever I want it to be"
End If
(More If code for other combinations)
Select Case TxtBoxone And TxtBoxtwo
Case 111 And 222: LblTheResult = "Whatever I want it to be"
(More case code for other combinations)
End Select
I've tried converting the Text boxes to Integers, Doubles, Singles, Strings, Currencies... I've tried making LblTheResult the end result for both text boxes, and the numbers are right- but some of them still just call up the wrong words! I've had two IDENTICAL Case statements except for the second text box's entry and the entry in qoutation marks, and both of them made LblTheResult equal to the same thing.
Any help would be appreciated, thanks.
-
Oct 9th, 2000, 01:59 AM
#2
Hyperactive Member
Post some code next time . try something like this with a select Case
Code:
Select Case Number
Case Is = 222
'It was 222
Do something here
Case is = 333
Something else here
End Select
Good Luck
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Oct 9th, 2000, 02:09 AM
#3
Hyperactive Member
Hy post all your code it can't be that long. Let us have a look and we will see what we can do about your problem. We just need some code to work with.
-
Oct 9th, 2000, 08:28 AM
#4
Griffin, PitbullCr, et al.....
You're looking at a 1000 x 1000 array here, with 000, 111, ..., 999 being the diagonal. Unless you have some way of grouping the results (anything with box1=1?? is blue....), you are going to have to handle 1,000,000 different conditions.
Sounds to me like a design problem. I'd need to know what the different boxes represent and what the different numbers inside the boxes imply.
Good Luck
DerFarm
-
Oct 9th, 2000, 01:04 PM
#5
Thread Starter
New Member
I did post an example of my code... And I only need to insert about 100 combinations and a Case Else for the rest. I'll try using the Do command thought, thanks.
And each box has the first three digits of a Zip Code... does that help you any?
-
Oct 9th, 2000, 01:35 PM
#6
Griffin> Please provide an example of which numbers do not work. They seem to work fine for me.
-
Oct 9th, 2000, 05:02 PM
#7
Hyperactive Member
Originally posted by Griffin
I did post an example of my code... And I only need to insert about 100 combinations and a Case Else for the rest. I'll try using the Do command thought, thanks.
And each box has the first three digits of a Zip Code... does that help you any?
I see that NOW and I read it before . I apologize I was under the influence of fibinootchi .
Sorry ,
[]P
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Oct 10th, 2000, 08:33 AM
#8
Actually, knowing that the terms are zip codes does make a difference.
It is my impression that zip codes (generally speaking) do not cross political boundaries. Note the use of the operative term generally speaking.
Assume your problem was to generate an approximate distance between two zipcodes. The first 2 digits can identify the state (35 and 36 for Alabama). Presumably, the 3rd digit would detail a specific region within the state (2 identifies the Birmingham area). Knowing the state and general region of the other zipcode would allow an easy lookup for the distance from Birmingham to ????.
You could write a function which would return the state and region based on table lookups for each of the zips. Then you'd need a map/distance function to return the appropriate distance.
You can define the localities by running a small program against the yellow pages for the various states. There should be several on the net. At the worst case, you can buy an old copy of the national phone registeries from some small company.
Good Luck
DerFarm
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
|