IF THEN ELSE Statement

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2009
Posts: 95
Reputation: gingank is an unknown quantity at this point 
Solved Threads: 0
gingank's Avatar
gingank gingank is offline Offline
Junior Poster in Training

IF THEN ELSE Statement

 
0
  #1
Sep 23rd, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 255
Reputation: AndreRet is an unknown quantity at this point 
Solved Threads: 38
AndreRet AndreRet is offline Offline
Posting Whiz in Training

Re: IF THEN ELSE Statement

 
0
  #2
Sep 23rd, 2009
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.
Please mark questions as answered when done.

Be the ONE!!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 178
Reputation: Vineeth K is an unknown quantity at this point 
Solved Threads: 9
Vineeth K's Avatar
Vineeth K Vineeth K is offline Offline
Junior Poster

Re: IF THEN ELSE Statement

 
0
  #3
Sep 23rd, 2009
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.
Who wants to be a GOD ??
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 95
Reputation: gingank is an unknown quantity at this point 
Solved Threads: 0
gingank's Avatar
gingank gingank is offline Offline
Junior Poster in Training

Re: IF THEN ELSE Statement

 
0
  #4
Sep 23rd, 2009
Originally Posted by AndreRet View Post
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Re: IF THEN ELSE Statement

 
0
  #5
Sep 24th, 2009
yes that will work the way you want.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 178
Reputation: Vineeth K is an unknown quantity at this point 
Solved Threads: 9
Vineeth K's Avatar
Vineeth K Vineeth K is offline Offline
Junior Poster

Re: IF THEN ELSE Statement

 
0
  #6
Sep 24th, 2009
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
Who wants to be a GOD ??
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Re: IF THEN ELSE Statement

 
0
  #7
Sep 24th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 57
Reputation: omoridi is an unknown quantity at this point 
Solved Threads: 8
omoridi omoridi is offline Offline
Junior Poster in Training

Re: IF THEN ELSE Statement

 
0
  #8
Sep 28th, 2009
simple code
  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
  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

  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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 178
Reputation: Vineeth K is an unknown quantity at this point 
Solved Threads: 9
Vineeth K's Avatar
Vineeth K Vineeth K is offline Offline
Junior Poster

Re: IF THEN ELSE Statement

 
0
  #9
Sep 28th, 2009
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 ]
Who wants to be a GOD ??
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 57
Reputation: omoridi is an unknown quantity at this point 
Solved Threads: 8
omoridi omoridi is offline Offline
Junior Poster in Training

Re: IF THEN ELSE Statement

 
0
  #10
Sep 29th, 2009
i donot know what u want exacly but if vb have iif maybe it work for u

  1. a=iif(b=c,d,f)

this syntax like thsi
  1. if b=c then
  2. a=d
  3. else
  4. a=f
  5. end if
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC