943,515 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Sep 23rd, 2009
0

IF THEN ELSE Statement

Expand Post »
Ho guys i got question need to ask about the if else statement:

Can i write like this

IF CUST= "A" OR CUST = "B" OR CUST = "C" THEN CUST = "A , B ,C "

Then statement i pal is if i key either A , B or C is will print out the data of A , B & C.

It is correct is write this using VB?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
gingank is offline Offline
108 posts
since Jun 2009
Sep 23rd, 2009
0

Re: IF THEN ELSE Statement

I'm not sure what exactly you want to do here. Do you want to call specific data and then only show that data? If that data is not available do you want to show all the data?

Please be more specific, and I'm sure we can help here.
Reputation Points: 329
Solved Threads: 346
Senior Poster
AndreRet is offline Offline
3,700 posts
since Jan 2008
Sep 23rd, 2009
0

Re: IF THEN ELSE Statement

Yes , no doubt you can do that ,
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. IF CUST= "A" OR CUST = "B" OR CUST = "C" THEN CUST = "A , B ,C "
It is useful when you need to check same condition or to create an advanced search !
I used this when i created an interacting program test.It started like this :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. If Text1.Text = "what is your name" Or Text1.Text = "name please" Or Text1.Text = "who are you" Then
  2. MsgBox "My name is System"
  3. ElseIf Text1.Text = "how old are you" Or Text1.Text = "age please" Then
  4. MsgBox "i am 10 years old !"
  5. ElseIf Text1.Text = "please help me" Or Text1.Text = "i need help" Or Text1.Text = "look at me" Then
  6. MsgBox "yes , tell me your problem !"
  7. End If
Last edited by Vineeth K; Sep 23rd, 2009 at 12:24 pm.
Reputation Points: 20
Solved Threads: 18
Posting Whiz in Training
Vineeth K is offline Offline
206 posts
since Sep 2009
Sep 23rd, 2009
0

Re: IF THEN ELSE Statement

Click to Expand / Collapse  Quote originally posted by AndreRet ...
I'm not sure what exactly you want to do here. Do you want to call specific data and then only show that data? If that data is not available do you want to show all the data?

Please be more specific, and I'm sure we can help here.

I obly want to call the specific data only that is A,B & C. If i input either one a ,or b it will call out thre data of all the ABC one
Reputation Points: 10
Solved Threads: 0
Junior Poster
gingank is offline Offline
108 posts
since Jun 2009
Sep 24th, 2009
0

Re: IF THEN ELSE Statement

yes that will work the way you want.
Reputation Points: 31
Solved Threads: 29
Posting Whiz in Training
ProfessorPC is offline Offline
270 posts
since Dec 2007
Sep 24th, 2009
0

Re: IF THEN ELSE Statement

Not that code , this one also work and this is used for more advanced search or security control.In this case the program will work only after comparing 2 conditions at the same time !
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. If Text1.Text = "what is your name" And Text2.Text = "name please" Then
  2. MsgBox "My name is System"
  3. ElseIf Text1.Text = "how old are you" And Text2.Text = "age please" Then
  4. MsgBox "i am 10 years old !"
  5. ElseIf Text1.Text = "please help me" And Text2.Text = "i need help" Then
  6. MsgBox "yes , tell me your problem !"
  7. End If
Reputation Points: 20
Solved Threads: 18
Posting Whiz in Training
Vineeth K is offline Offline
206 posts
since Sep 2009
Sep 24th, 2009
0

Re: IF THEN ELSE Statement

from the question. i take they want it to work if any of the conditions = a b or c. if thats the way it works then yes the first if statement will work
Reputation Points: 31
Solved Threads: 29
Posting Whiz in Training
ProfessorPC is offline Offline
270 posts
since Dec 2007
Sep 28th, 2009
0

Re: IF THEN ELSE Statement

simple code
vb Syntax (Toggle Plain Text)
  1. if a=a or b=b or c=c and d=d then f=f
  2. 'or
  3. if a=a or b=b or c=c and d=d then
  4. f=f
  5. end if
or more
vb Syntax (Toggle Plain Text)
  1. if a=a or b=b or c=c and d=d then
  2. f=f
  3. else
  4. f=g
  5. end if

or more

vb Syntax (Toggle Plain Text)
  1. if a=a or b=b or c=c and d=d then
  2. f=f
  3. elseif c=c and d=d then
  4. f=h
  5. elseif d=d then
  6. f=i
  7. else
  8. f=g
  9. end if
Last edited by omoridi; Sep 28th, 2009 at 11:48 am.
Reputation Points: 10
Solved Threads: 10
Junior Poster in Training
omoridi is offline Offline
72 posts
since Sep 2009
Sep 28th, 2009
0

Re: IF THEN ELSE Statement

I can't find nothing new in that code ???
I am looking for new IF statements ,

If you got rare and new ideas then
" give me that "
Else
" That code must be waste "
End if
[ hehehehehehehe ]
Reputation Points: 20
Solved Threads: 18
Posting Whiz in Training
Vineeth K is offline Offline
206 posts
since Sep 2009
Sep 29th, 2009
0

Re: IF THEN ELSE Statement

i donot know what u want exacly but if vb have iif maybe it work for u

vb Syntax (Toggle Plain Text)
  1. a=iif(b=c,d,f)

this syntax like thsi
vb Syntax (Toggle Plain Text)
  1. if b=c then
  2. a=d
  3. else
  4. a=f
  5. end if
Reputation Points: 10
Solved Threads: 10
Junior Poster in Training
omoridi is offline Offline
72 posts
since Sep 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Integer automatically rounded when put in array
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to launch an application





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC