2. Set Listview property
FullRowSelect = True
GridLines = True
UseCompatibleStateImageBehavior = False
View = Details
3. Using System.Windows.Forms.ListView
4. Sample code to add item to listview (When click button add item to listview)
Dim pObj As New ListViewItem("Code")
pObj.SubItems.Add("Item Name")
pObj.SubItems.Add("10.00")
pObj.SubItems.Add("1")
pObj.SubItems.Add("1.50"))
pObj.SubItems.Add("15.00")
pObj.Tag = 1 ' keep materail id ListView1.Items.Add(pObj)
5. Sample code to delete item in listview when press delete on keyboard.
Private Sub ListView1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lstMaterial.KeyUp
If e.KeyCode = Keys.Delete AndAlso ListView1.SelectedItems.Count > 0 Then
For i As Integer = ListView1.SelectedItems.Count - 1 To 0 Step -1
ListView1.Items.RemoveAt(ListView1.SelectedItems(i).Index)
Next
End If
End Sub
Source: http://vbnetsample.blogspot.com/2011/06/1.html
small business forums how to forums how to forum how to make a forum how to make forums how to make a signature for forums how to make your own forums how to program a forum how to program forum rock band forums
ليست هناك تعليقات:
إرسال تعليق