5 Replies - 11211 Views - Last Post: 23 April 2012 - 01:55 PM Rate Topic: -----

#1 jencalma  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 89
  • Joined: 13-July 07

choose and inline if

Posted 31 December 2008 - 10:07 PM

can please somebody help me on how to use CHOOSE and INLINE IF and also the IIF or the immediate if,, tnx a lot :)
Is This A Good Question/Topic? 0
  • +

Replies To: choose and inline if

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1634
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: choose and inline if

Posted 31 December 2008 - 11:22 PM

Here's the documentation on the IIf Statement, which is an inline If statement. Never heard of the CHOOSE command?
Was This Post Helpful? 0
  • +
  • -

#3 jencalma  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 89
  • Joined: 13-July 07

Re: choose and inline if

Posted 31 December 2008 - 11:39 PM

View PostPsychoCoder, on 31 Dec, 2008 - 10:22 PM, said:

Here's the documentation on the IIf Statement, which is an inline If statement. Never heard of the CHOOSE command?

thankyou very much for the help,,
have you heard about the inline if?????//
and what's the difference of immediate if to inline if?

This post has been edited by jencalma: 31 December 2008 - 11:43 PM

Was This Post Helpful? 0
  • +
  • -

#4 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4191
  • View blog
  • Posts: 11,864
  • Joined: 18-April 07

Re: choose and inline if

Posted 31 December 2008 - 11:57 PM

Many languages like C++/C#, Javascript etc have had inline ifs for a long time. VB.NET just recently introduced one with a tad of a different twist. The format is like such...

' Takes the form of... 
' result = If(TestExpressionObject,IfFalsePart)

' Example
Dim blah as Nullable(Of Integer)
Dim result as integer

' Result will have the value 99 because it is null
result = If(blah,99)

blah = 2

' Result will have 2 because blah was not null
result = If(blah,99) 



But like Psycho I am not sure of this choose statement you speak of. Maybe I am just missing something. But anyways, there you go with the inline if.

Enjoy!

"At DIC we be nullable type testing code ninjas... we also test soft drinks, cigarettes and anything that will kill normal people over large periods of time" :snap:
Was This Post Helpful? 0
  • +
  • -

#5 mrmcpott  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 95
  • Joined: 24-November 08

Re: choose and inline if

Posted 13 January 2009 - 12:54 AM

I'm not sure exactly what you are asking, but using labels might help you. I used them in a large program of mine to go to different parts of the code based on an if statement.

Here is an example of what I did:

'lets test a variable from some input like textbox, listbox, etc.
   Dim i As Integer
		If i > 5 Then
			GoTo GREATERTHAN
		Else
			GoTo LESSTHAN
		End If
GREATERTHAN:
		MessageBox.Show("It was greater than five")
		Exit Sub 'I add this so all of the labels below will not execute.
LESSTHAN:
		MessageBox.Show("It was less than five")
		Exit Sub



To make a label in VB.NET all you have to do is type some text and place ":" after it. Like:
newlabel:
ANOTHERLABEL:



Then use the GoTo statement to go to that label in a procedure.
Was This Post Helpful? 0
  • +
  • -

#6 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 571
  • View blog
  • Posts: 2,979
  • Joined: 19-May 09

Re: choose and inline if

Posted 23 April 2012 - 01:55 PM

Justifiable necropost: here is the doc for Choose. Basic format is choose(index, array), where array is an array of values, and index is the 1-based offset of the element in the array to return.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1