Private Sub Btn_ShowAll_Click(sender As System.Object, e As System.EventArgs) Handles Btn_ShowAll.Click Dim da As New SqlDataAdapter("Select * From Tablexy", con) Dim ds As New DataTable("Tablexy") Dim dgr As DataGridViewRow con.Open() da.Fill(ds) Dgv1.DataSource = ds con.Close() For r As Int32 = 0 To Dgv1.Rows.Count - 2 dgr = Dgv1.Rows(r) For i As Int32 = 0 To dgr.Cells.Count - 2 If Convert.ToString(dgr.Cells(i).Value) = "" Then dgr.Cells(i).Value = vbNull End If Next Next End Sub
vbNull
dgr.Cells(i).Value = DBNull.Value
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)