|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Select Case and If Then DecisionsI 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 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 Show quoteHide quote "DAL" <dalmailbox-m***@yahoo.com> wrote in message news:utMSzq8JGHA.1288@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 > label1.text = listbox1.selecteditem.tostring + listbox2.selecteditem.tostring
or am i missing something? Show quoteHide quote "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 > > > "DAL" <dalmailbox-m***@yahoo.com> wrote in message Personally, I'd use /another/ Select Case, as innews:utMSzq8JGHA.1288@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. 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.
Interview Questions Feb 01 2006
TimeOfDay adds 1/1/0001 to the Time value? Exemple needed to reorganize nodes(treeview) with mouse (change Nodes order) Generating a WSDL for your Web Service Need help with OLEDB query expression AlternatingItemStyle color question Security/Permission issues with Citrix and VB.Net string to double try parse ---decimals lost XP 64 and VS 2003 Detect version of .Net (not in a Setup project) |
|||||||||||||||||||||||