Button As Listview Subitem?
Is this possible?
I need to have a button in each row of my listview, but it doesn't look like it can be done. here is my listview code so far.
Code:
Me.TextBox1.Enabled = True
Me.Button3.Enabled = True
Using connection As New MySqlConnection(";")
Me.ListView1.Items.Clear()
Using command As New MySqlCommand("SELECT name, type, uploaded, uploader, location FROM programs", connection)
connection.Open()
Using reader As MySqlDataReader = command.ExecuteReader()
While (reader.Read())
Dim name As String = reader("name")
Dim type As String = reader("type")
Dim uploaded As String = reader("uploaded")
Dim uploader As String = reader("uploader")
Dim location As String = reader("location")
Dim strKey As String = location
Dim lst As ListView = Me.ListView1
If Not lst.Items.ContainsKey(strKey) Then
Dim lv As ListViewItem = lst.Items.Add(location)
lv.SubItems.Add(name)
lv.SubItems.Add(type)
lv.SubItems.Add(uploaded)
lv.SubItems.Add(uploader)
lv.SubItems.Add("NEED BUTTON HERE")
End If
End While
End Using
End Using
End Using
Re: Button As Listview Subitem?
The ListView control doesn't inherently support embedded controls. You might consider using a DataGridView instead, which does support embedded controls and supports buttons by default. The DataGridView has other advantages over the ListView too.
If you must use a ListView for some specific reason then you should look at this.
Re: Button As Listview Subitem?
Could do it in easily in WPF :D
sorry.