I have a combo with several items. With the selection of each individual item, a different action would be performed. Is there a way to code this simply rather than using 19 separate IF/THEN statements?
Currently it would look something like this:
If cboComboBox.Text = X Then
A=B
This is just an example. But imagine that about 20 times. It gets a little long.
+ Reply to Thread
Results 1 to 4 of 4
-
-
I haven't coded in VB in a long time (probably since VB3) and have only recently dabbled with C#, so maybe this wont help, but what about a case type statement. Not a lot less work, but probably easier in the long run. Don't know the exact syntax though.
Read my blog here.
-
Case syntax would be something like the following (in the cboComboBox_Change() sub) :
Code:Select Case cboComboBox.Text Case "X" A=B Case "Y" C=D Case Else E=F End Select
... or alternatively you *might* be able to use an array.If in doubt, Google it.
Similar Threads
-
XMP – Metadata related question
By pavinm in forum Newbie / General discussionsReplies: 2Last Post: 21st Jul 2010, 14:53 -
A question related to sub files and resized avi with AGK
By loninappleton in forum Newbie / General discussionsReplies: 7Last Post: 19th Jul 2009, 22:35 -
DTV converter box, screen size-related question
By Ai Haibara in forum DVB / IPTVReplies: 6Last Post: 22nd Nov 2008, 18:18 -
Fraps and Ventrilo Related Question
By combatsimulation in forum AudioReplies: 0Last Post: 23rd Feb 2008, 19:05 -
You Tube related question
By bja5150 in forum ComputerReplies: 2Last Post: 24th Dec 2007, 10:39