I am developing a Windows Forms Based Application using dbo.database and Visual Basic:
I populate some Orders in DataGridView1 using LINQ 2 SQL from "tbl_Orders" where OrderStatus is "Pending". I change OrderStatus Column Type to "CheckBox" in DataGridView, Now I want that when I select some records (Orders) by checking respective checkboxes and click on "btn_UpdateStatus" Button, program pick OrderID's of only selected orders and update OrderStatus of Only selected Records (Orders) from "Pending" to "Completed" in Database Table "tbl_Orders" and DataGridView1 should be Refreshed.
I am using VB, Kindly help me with complete solution?
Code Im using is:
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click Dim ID As Integer = DirectCast(DataGridViewIU68E.SelectedRows(0).Cells("EvaluationIDDataGridViewTextBoxColumn").Value, Integer) For i = 1 To DataGridViewIU68E.SelectedRows.Count Dim db As New IU68IL33EvaluationDataContext Dim ee = From u In db.IU68_IL33_Evaluations _ Where u.EvaluationID = ID _ Select u ee.EmailStatus = "Done" db.SubmitChanges() Next End Sub