|
-
Jul 6th, 2000, 01:40 PM
#1
Thread Starter
Junior Member
i would like to compare two statements
sub car()
if newcar = "red" Then
Car can't = "0"
end if
end sub
how would I write this
-
Jul 6th, 2000, 01:45 PM
#2
Registered User
Man
I am sure there are some more ppl who didnt understand what you are trying to compare.
do u wanna compare Strings ? what do u mean to compare "Statements" ?!
explain yourself please.
-
Jul 6th, 2000, 01:49 PM
#3
Thread Starter
Junior Member
i would like to compare the 2 strings.
newcar = red
car can't =0"
-
Jul 6th, 2000, 05:12 PM
#4
Fanatic Member
NOt sure what you want but to compare two strings:
Code:
Dim strOne As String
Dim strTwo As String
If strOne = strTwo Then
MsgBox "Strings Are Identical"
Else
MsgBox "Strings Are Different"
End if
Going back to your code: what does it say??? (especially the Car Can't = "0" part makes me confused)
-
Jul 6th, 2000, 05:30 PM
#5
_______
<?>
if your variables are strings and the strings are
Sring1 = newcar
String2 = car
and it looks like you want to say that if
newcar is red then it cannot be 0
if that is the case this is the statement.
if newcar = "red" then car <> "0"
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 6th, 2000, 07:22 PM
#6
Hyperactive Member
Heres a help..
Hi Raven123,
You look like you need a help with a bit of analysis rather than specific statements (although maybe that too)
To help you to analyse your problem and to help you to express your question more fully, try using a technique like the following one.
Draw up a number of columns on a piece of paper with headers on the names of the variables you want to use
Now, draw up a final column and call it "Result" or something like that which means something to you.
Now, fill in the columns as many times as needed until you think you have accounted for every type of combination of variables.
Now think about the results in each case and write what you want the result to be.
I will do this as an example and see if you get a similar result.
Code:
newcar car Result
"red" "1" valid
"red" "0" invalid
"blue" "1" valid
"blue" "0" valid
In this case, your if statement would be
Code:
If (newcar = "red") And (car <> "0") then Result = true
Unfortunately there was not enough information to fully appreciate what you intend the Sub to do, but looking at the problem on paper like I hopefully have demonstrated might help you to get an exact answer to your question..
Regards
Paul Lewis
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
|