How to delete,update records in listview? Changes also affect the database?

Recommended Answers

All 3 Replies

How to delete,update records in listview? Changes also affect the database?

How are you loading the data into the listview?

How are you loading the data into the listview?

my code is below

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListView1.Columns.Add("Emp Name", 100, HorizontalAlignment.Left)
        ListView1.Columns.Add("Emp No", 100, HorizontalAlignment.Left)
        ListView1.Columns.Add("Department", 60, HorizontalAlignment.Left)
        ListView1.Columns.Add("Salary", 60, HorizontalAlignment.Left)
      
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim str(4) As String
        Dim itm As ListViewItem
        str(0) = TextBox1.Text
        str(1) = TextBox2.Text
        str(2) = TextBox3.Text
        str(3) = TextBox4.Text
        itm = New ListViewItem(str)
        ListView1.Items.Add(itm)
    End Sub

Now, How can i delete,update in listview?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.