title: Random Numbers to Text in Label
body: <pre><code>Public Class MainForm
  
  Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
      Me.Close()
  End Sub
  
  Private Sub guestsTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles guestsTextBox.KeyPress
      ' allows only numbers and the Backspace key
  
      If (e.KeyChar &lt; "0" OrElse e.KeyChar &gt; "9") AndAlso
          e.KeyChar &lt;&gt; ControlChars.Back Then
          e.Handled = True
      End If
  End Sub
  
  Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      'fills the list box and selects the first item
  
      typeListBox.Items.Add("Kid's Birthday")
      typeListBox.Items.Add("21st Birthday")
      typeListBox.Items.Add("40th Birthday")
      typeListBox.Items.Add("Other Birthday")
      typeListBox.SelectedIndex = 0
  End Sub
  
  Private Sub calcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles calcButton.Click
      'displays the total charge
  
      Dim guests As Integer
      Dim typeIndex As Integer
      Dim guestPrice As Integer
      Dim totalCharge As Integer
  
      Integer.TryParse(guestsTextBox.Text, guests)
      typeIndex = typeListBox.SelectedIndex
  
      'determine the price per guest
      Select Case typeIndex
          Case 0 'Kid's Birthday
              guestPrice = 11
          Case 1 '21st Birthday
              guestPrice = 20
          Case 2 '40th Birthday
              guestPrice = 25
          Case Else 'other birthdays
              guestPrice = 15
      End Select
  
      'calculate and display the total charge
      totalCharge = guests * guestPrice
      totalLabel.Text = totalCharge.ToString("C0")
  End Sub
  
  Private Sub testDataButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles testDataButton.Click
      Dim guests As Integer
      Dim typeIndex As Integer
      Dim guestPrice As Integer
      Dim totalCharge As Integer
      Dim randomGen As New Random
      Dim setCounter As Integer = 1
  
      testDataLabel.Text = String.Empty
  
      Do
          guests = randomGen.Next(1, 51)
          typeIndex = randomGen.Next(0, 4)
  
          For Each I As Object In typeListBox.SelectedItems
              testDataLabel.Text += I.ToString() &amp; ControlChars.NewLine
          Next
  
          'determine the price per guest
          Select Case typeListBox.SelectedIndex
              Case 0
                  guestPrice = 11
              Case 1
                  guestPrice = 20
              Case 2
                  guestPrice = 25
              Case Else
                  guestPrice = 15
          End Select
  
          'calculate and display the total charge
          totalCharge = guests * guestPrice
          testDataLabel.Text = testDataLabel.Text &amp;
              typeIndex.ToString &amp; "    " &amp;
              guests.ToString &amp; "    " &amp;
              totalCharge.ToString("C0") &amp;
              ControlChars.NewLine
          setCounter += 1
  
  
      Loop Until setCounter &gt; 10
  
  End Sub
  
  Private Sub typeListBox_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles typeListBox.SelectedIndexChanged
  
  End Sub
  End Class
  </code></pre>
  
  <p>When I click on a button named "Generate Test Data" It generates a list of random numbers in a label. I want these numbers to say the type of birthday instead of the number.</p>
  
  <p>0 being "Kid's Birthday"</p>
  
  <p>1 being "21st Birthday"</p>
  
  <p>2 being "40th Birthday"</p>
  
  <p>and 3 being "Other Birthday"</p>
  
  <p>How would I go about doing this? </p>
  
  <p>Any help would be much appreciated!</p>