Click here to Skip to main content
15,917,481 members
Articles / Programming Languages / Visual Basic
Article

ListBox Searching

Rate me:
Please Sign up or sign in to vote.
3.14/5 (8 votes)
11 Sep 2006 77.2K   3.1K   30   13
How to search ListBoxes: Full Search: Index Search: Text Search: Case Sensative Text Search

Sample image

Introduction

This code shows you how to search through a ListBox (ListBox1) and add all Items that match the search query (from TextBox1) to a second ListBox (ListBox2).

Using The Source Code

I have included two sets of the source code, one with comments, and one without.  I did this because the begginers have a better chance of needed comments to walk them through the steps, but they might just be more in the way than anything else for the more advanced programmers.

The Source Code

 <FONT size=2><P></FONT><FONT color=#0000ff size=2>Private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Sub</FONT><FONT size=2> btnSearch_Click(</FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> sender </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> System.Object, </FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> e </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> System.EventArgs) _</FONT></P><P><FONT color=#0000ff size=2>  Handles</FONT><FONT size=2> btnSearch.Click</FONT><FONT size=2></P><P></FONT><FONT color=#008000 size=2>      '//removes all items from the second List Box</P></FONT><FONT size=2><P>    ListBox2.Items.Clear()</P><P></FONT><FONT color=#008000 size=2>      '//gets the total number of items in the first ListBox</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    Dim</FONT><FONT size=2> listLength </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</FONT><FONT size=2> = (ListBox1.Items.Count - 1)</P><P></FONT><FONT color=#008000 size=2>      '//i -> counter through loops : j -> counter through chars in string</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    Dim</FONT><FONT size=2> i, j </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>      '//listString -> string of item in ListBox1</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>      '//newString -> gets added to one char at a time from listString </P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    Dim</FONT><FONT size=2> listString, newString </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>String</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>'//self explanitory, lol</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    If</FONT><FONT size=2> radioFull.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>          '//loop through all items in ListBox1</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P></FONT><FONT color=#008000 size=2>              '//one at a time in sequential order</P></FONT><FONT size=2><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#008000 size=2>              '//searches ListBox1 Item for the text in TextBox1</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//turning all text to lowercase</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            If</FONT><FONT size=2> InStr(listString.ToLower, TextBox1.Text.ToLower) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                  '//if text is found then add ListBox1 Item to ListBox2</P></FONT><FONT size=2><P>                ListBox2.Items.Add(listString)</P><P></FONT><FONT color=#0000ff size=2>            End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</FONT><FONT color=#0000ff size=2></P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>'//search Item Index</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    ElseIf</FONT><FONT size=2> radioIndex.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#008000 size=2>              '//loop through listString 1 char at a time</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            For</FONT><FONT size=2> j = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listString.Length - 1</P><P></FONT><FONT color=#008000 size=2>                  '//goes through first If until you get to a Space Char</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                  '//if char is NOT Space Char then</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                If</FONT><FONT size=2> listString.Substring(j, 1) <> Chr(32) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                      '//add char to newString</P></FONT><FONT size=2><P>                    newString += listString.Substring(j, 1)</P><P></FONT><FONT color=#0000ff size=2>                Else</FONT><FONT size=2>  </FONT><FONT color=#008000 size=2>'//once you get to a Space Char</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                      '//searches ListBox1 Item for the text in TextBox1</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                    If</FONT><FONT size=2> InStr(newString, TextBox1.Text) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                          '//add Item to ListBox2</P></FONT><FONT size=2><P>                        ListBox2.Items.Add(ListBox1.Items.Item(i))</P><P></FONT><FONT color=#0000ff size=2>                    End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                      '//Exit For Statement</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                    Exit</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>For</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            Next</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//empties newString for the next round!</P></FONT><FONT size=2><P>            newString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//time to search next Item in ListBox1</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</P></FONT><P><FONT color=#008000 size=2>'//search Text, non Case Sensative</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    ElseIf</FONT><FONT size=2> radioText.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>          '//holds number of Space Chars</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Dim</FONT><FONT size=2> spaceCharCounter </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</FONT><FONT size=2> = 0</P><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#008000 size=2>              '//go through Item 1 char at a time</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            For</FONT><FONT size=2> j = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listString.Length - 1</P><P></FONT><FONT color=#008000 size=2>                  '//if spaceCharCounter is greater than or equal to 2</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                If</FONT><FONT size=2> spaceCharCounter >= 2 </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                      '//add Char to newString</P></FONT><FONT size=2><P>                    newString += listString.Substring(j, 1)</P><P></FONT><FONT color=#008000 size=2>                      '//if char in listString = Space Char</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                ElseIf</FONT><FONT size=2> listString.Substring(j, 1) = Chr(32) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                      '//add 1 to spaceCharCounter</P></FONT><FONT size=2><P>                    spaceCharCounter += 1</P><P></FONT><FONT color=#0000ff size=2>                End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                  '//next Char in ListBox1 Item</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            Next</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//search with all lowercase</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            If</FONT><FONT size=2> InStr(newString.ToLower, TextBox1.Text.ToLower) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>                  '//add Item to ListBox2</P></FONT><FONT size=2><P>                ListBox2.Items.Add(ListBox1.Items.Item(i))</P><P></FONT><FONT color=#0000ff size=2>            End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//delete values</P></FONT><FONT size=2><P>            listString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P>            spaceCharCounter = 0</P><P>            newString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//search next Item in ListBox1</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>'//search Text, Case Sensative</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    ElseIf</FONT><FONT size=2> radioAdvText.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Dim</FONT><FONT size=2> spaceCharCounter </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</FONT><FONT size=2> = 0</P><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#0000ff size=2>            For</FONT><FONT size=2> j = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listString.Length - 1</P><P></FONT><FONT color=#0000ff size=2>                If</FONT><FONT size=2> spaceCharCounter >= 2 </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                    newString += listString.Substring(j, 1)</P><P></FONT><FONT color=#0000ff size=2>                ElseIf</FONT><FONT size=2> listString.Substring(j, 1) = Chr(32) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                    spaceCharCounter += 1</P><P></FONT><FONT color=#0000ff size=2>                End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            Next</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//***The one difference between the last 2 radio buttons</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>              '//***There is NO .ToLower in search function</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            If</FONT><FONT size=2> InStr(newString, TextBox1.Text) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                ListBox2.Items.Add(ListBox1.Items.Item(i))</P><P></FONT><FONT color=#0000ff size=2>            End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P>            listString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P>            spaceCharCounter = 0</P><P>            newString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P>    listString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>End Sub</FONT></P><P> </P>

Now without the comments.

<FONT size=2><P></FONT><FONT color=#0000ff size=2>Private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Sub</FONT><FONT size=2> btnSearch_Click(</FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> sender </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> System.Object, </FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> e </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> System.EventArgs) _</FONT></P><P>  <FONT color=#0000ff size=2>Handles</FONT><FONT size=2> btnSearch.Click</P><P>    ListBox2.Items.Clear()</P><P></FONT><FONT color=#0000ff size=2>    Dim</FONT><FONT size=2> listLength </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</FONT><FONT size=2> = (ListBox1.Items.Count - 1)</P><P></FONT><FONT color=#0000ff size=2>    Dim</FONT><FONT size=2> i, j </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    Dim</FONT><FONT size=2> listString, newString </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>String</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    If</FONT><FONT size=2> radioFull.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#0000ff size=2>            If</FONT><FONT size=2> InStr(listString.ToLower, TextBox1.Text.ToLower) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                ListBox2.Items.Add(listString)</P><P></FONT><FONT color=#0000ff size=2>            End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    ElseIf</FONT><FONT size=2> radioIndex.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#0000ff size=2>            For</FONT><FONT size=2> j = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listString.Length - 1</P><P></FONT><FONT color=#0000ff size=2>                If</FONT><FONT size=2> listString.Substring(j, 1) <> Chr(32) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                    newString += listString.Substring(j, 1)</P><P></FONT><FONT color=#0000ff size=2>                Else</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                    If</FONT><FONT size=2> InStr(newString, TextBox1.Text) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                        ListBox2.Items.Add(ListBox1.Items.Item(i))</P><P></FONT><FONT color=#0000ff size=2>                    End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                Exit</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>For</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>                End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            Next</P></FONT><FONT size=2><P>            newString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    ElseIf</FONT><FONT size=2> radioText.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Dim</FONT><FONT size=2> spaceCharCounter </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</FONT><FONT size=2> = 0</P><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#0000ff size=2>            For</FONT><FONT size=2> j = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listString.Length - 1</P><P></FONT><FONT color=#0000ff size=2>                If</FONT><FONT size=2> spaceCharCounter >= 2 </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                    newString += listString.Substring(j, 1)</P><P></FONT><FONT color=#0000ff size=2>                ElseIf</FONT><FONT size=2> listString.Substring(j, 1) = Chr(32) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                    spaceCharCounter += 1</P><P></FONT><FONT color=#0000ff size=2>                End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            Next</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            If</FONT><FONT size=2> InStr(newString.ToLower, TextBox1.Text.ToLower) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                ListBox2.Items.Add(ListBox1.Items.Item(i))</P><P></FONT><FONT color=#0000ff size=2>            End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P>            listString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P>            spaceCharCounter = 0</P><P>            newString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    ElseIf</FONT><FONT size=2> radioAdvText.Checked = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Dim</FONT><FONT size=2> spaceCharCounter </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer</FONT><FONT size=2> = 0</P><P></FONT><FONT color=#0000ff size=2>        For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listLength</P><P>            listString = ListBox1.Items.Item(i)</P><P></FONT><FONT color=#0000ff size=2>            For</FONT><FONT size=2> j = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> listString.Length - 1</P><P></FONT><FONT color=#0000ff size=2>                If</FONT><FONT size=2> spaceCharCounter >= 2 </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                    newString += listString.Substring(j, 1)</P><P></FONT><FONT color=#0000ff size=2>                ElseIf</FONT><FONT size=2> listString.Substring(j, 1) = Chr(32) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                    spaceCharCounter += 1</P><P></FONT><FONT color=#0000ff size=2>                End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            Next</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>            If</FONT><FONT size=2> InStr(newString, TextBox1.Text) </FONT><FONT color=#0000ff size=2>Then</P></FONT><FONT size=2><P>                ListBox2.Items.Add(ListBox1.Items.Item(i))</P><P></FONT><FONT color=#0000ff size=2>            End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P>            listString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P>            spaceCharCounter = 0</P><P>            newString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>        Next</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>    End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If</P></FONT><FONT size=2><P>    listString = </FONT><FONT color=#0000ff size=2>Nothing</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Sub</FONT></P><FONT color=#0000ff></FONT>

The End

I would have seperated the different RadioButton.Checked statements for easier reading, but I'm having some problems with the editor.

Have Fun!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
3+ years Visual Basic.NET programming experience. A little ASP.NET and HTML as well.

Comments and Discussions

 
Questioncan i have exmaple in c# Pin
ManasAddy7-May-09 3:41
ManasAddy7-May-09 3:41 
Jokeexcellent Pin
Kuba.cz6-Oct-08 9:21
Kuba.cz6-Oct-08 9:21 
QuestionProblem about Listbox properties [modified] Pin
Newbie_dydy8515-Oct-06 23:30
Newbie_dydy8515-Oct-06 23:30 
GeneralToo much code! Pin
rpgmaker19-Sep-06 4:44
rpgmaker19-Sep-06 4:44 
QuestionWhat ever happened to white space? Pin
Bkins12-Sep-06 8:14
Bkins12-Sep-06 8:14 
AnswerRe: What ever happened to white space? Pin
Anthony Queen12-Sep-06 9:51
Anthony Queen12-Sep-06 9:51 
AnswerRe: What ever happened to white space? Pin
Yep-ItsMe12-Sep-06 11:23
Yep-ItsMe12-Sep-06 11:23 
GeneralLarge number of items Pin
Itay Sagui11-Sep-06 22:40
Itay Sagui11-Sep-06 22:40 
AnswerRe: Large number of items Pin
Yep-ItsMe12-Sep-06 6:43
Yep-ItsMe12-Sep-06 6:43 
GeneralHTML Editor Problems Pin
Yep-ItsMe11-Sep-06 11:33
Yep-ItsMe11-Sep-06 11:33 
AnswerRe: HTML Editor Problems Pin
Anthony Queen11-Sep-06 12:03
Anthony Queen11-Sep-06 12:03 
GeneralRe: HTML Editor Problems Pin
Yep-ItsMe11-Sep-06 15:06
Yep-ItsMe11-Sep-06 15:06 
Great! Much better, although it is still a little long like you pointed out. Thanks

it took a little trial and error, but...well, still nothing yet...

GeneralVoting... [modified] Pin
Yep-ItsMe11-Sep-06 11:31
Yep-ItsMe11-Sep-06 11:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.