I am using visual studio 2012 express. I have a form with a menu strip, 2 radiobuttons, and a listview. What I want to happen is when radiobutton2 is checked, the listview to populate with some numbers and a type (string). I have done something similar before in another project but it is not working in this project. I have read about what settings need to be set in a listview for it to work and I set them (see all of the links). I prefer to have the "Card #" variable shown first, then the type. If I try to run the code now, I only get 1 column filled in, the other one is always blank.
What I have tried:
This is the code that DON'T work!
<pre>
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged
Dim CardType As String = Nothing
Dim tmpStr As String = Nothing
RadioButton2.Font = IIf(RadioButton2.Checked = True, New Font(RadioButton2.Font, FontStyle.Bold), New Font(RadioButton2.Font, FontStyle.Regular))
If RadioButton2.Checked = True Then
ComboBox1.Items.Clear()
ComboBox1.Text = Nothing
ComboBox1.Enabled = False
ListView1.Enabled = True
For x As Integer = 1 To NumberOfCards
tmpStr = Trim(Mid(MyCard(x, 1, 1), 5, 1))
CardType = Microsoft.VisualBasic.Switch(tmpStr = "D", "Deleted", tmpStr = "H", "Hard", tmpStr = "S", "Special")
If tmpStr <> "D" Then
Dim wrditem As New ListViewItem
wrditem.Text = Str(x)
wrditem.SubItems.Add(CardType)
ListView1.Items.Add(wrditem.Text)
End If
Next
End If
End Sub
This is what I get when I run the code:
Running Form.jpg - Google Drive[
^]