473,320 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Select Case and If Then Decisions

DAL
I have a list of items in a list box and have used the Select Case decision
structure to add names to a label when a selection is made. How do I use an
If Then decision structure to concatenate two selections in different
listboxes.

ie.

If listbox1.selectedindex = case 0 And listbox2.selectedindex = case 25
Then
label1.text = case0 + case 25
End If
Feb 2 '06 #1
3 1662
Well you could better show us your hole decission structure

also note that in most situations when a lot of possible cases are involved
it might be faster and better ( readability ) to use a Select case
structure
regards

Michel Posseth
"DAL" <da*************@yahoo.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
I have a list of items in a list box and have used the Select Case decision
structure to add names to a label when a selection is made. How do I use an
If Then decision structure to concatenate two selections in different
listboxes.

ie.

If listbox1.selectedindex = case 0 And listbox2.selectedindex = case 25
Then
label1.text = case0 + case 25
End If

Feb 2 '06 #2
guy
label1.text = listbox1.selecteditem.tostring + listbox2.selecteditem.tostring

or am i missing something?

"DAL" wrote:
I have a list of items in a list box and have used the Select Case decision
structure to add names to a label when a selection is made. How do I use an
If Then decision structure to concatenate two selections in different
listboxes.

ie.

If listbox1.selectedindex = case 0 And listbox2.selectedindex = case 25
Then
label1.text = case0 + case 25
End If

Feb 2 '06 #3
"DAL" <da*************@yahoo.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
I have a list of items in a list box and have used the Select Case
decision structure to add names to a label when a selection is made. How
do I use an If Then decision structure to concatenate two selections in
different listboxes.


Personally, I'd use /another/ Select Case, as in

Option Strict On

Dim sKey as String _
= listbox1.SelectedIndex.ToString() _
& ":" & listbox2.SelectedIndex.ToString()

Select Case sKey
Case "0:25"
label1.Text = "0 25" ' ?
label1.Text = listbox1.SelectedItem.Text _
& " " & listbox2.SelectedItem.Text ' perhaps better?
End Select

HTH,
Phill W.
Feb 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: lkrubner | last post by:
Are there any benchmarks on how much an extra, unneeded VARCHAR, CHAR, INT, BIGINT, TEXT or MEDIUMTEXT slows down a database call with MySql? PostGre info would also be useful. I'm trying to...
19
by: Robert Scheer | last post by:
Hi. In VBScript I can use a Select Case statement like that: Select Case X Case 1 to 10 'X is between 1 and 10 Case 11,14,16 'X is 11 or 14 or 16 End Select
2
by: Max | last post by:
Hi, Is it possible to have different Select Expert formula for different column or Fields at once? I can't figure out how to calculate totals for different fields such as count and total of...
10
by: MLH | last post by:
Suppose the following... Dim A as Date A=#7/24/2005# I wish to compare value of A against 2 other values: 1) 8/1/2005 2) 9/1/2005 Which is better and why... First:
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
5
by: Bruce W.1 | last post by:
Looking at the html produced by Visual Studio I see a mixed bag of tag capitalization. For example there's <HEAD> and <body>. Then there's <form and <TABLE>. Is there some logic behind the mixed...
33
by: Peter | last post by:
People are telling me it is bad to put select * from <atable> in a view. I better should list all fields of the table inside the definition of the view. I dont know exactly why but some...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
5
by: sam_cit | last post by:
Hi Everyone, I read somewhere that there are some compile time operations behind switch-case, which is why it can work for cases which evaluates to an integer or character and not strings and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.