i have 3 columns in a datagridview.
i want to add values.
everything is working fine but when i add values there is a blank row at the beginning.
how can i remove this ?
here is my code
dataGridView2.Rows.Clear()
Dim oledbcom As New OleDb.OleDbCommand
oledbcom.CommandText = "Select Code,Weight,Unit from Contents where id = ? and [combination name] = ?"
oledbcom.Connection = oledbcon
oledbcom.Parameters.Add("?", OleDb.OleDbType.VarChar)
oledbcom.Parameters.Add("?", OleDb.OleDbType.VarChar)
oledbcom.Parameters(0).Value = dataGridView1.Item(0, dataGridView1.CurrentRow.Index).Value
oledbcom.Parameters(1).Value = lstColour.SelectedItem.ToString
oledbcon.Open()
Dim oledbreader As OleDb.OleDbDataReader = oledbcom.ExecuteReader
While oledbreader.Read
dataGridView2.Rows.Add()
dataGridView2.Item(0, dataGridView2.Rows.Count - 1).Value = oledbreader.GetString(0)
dataGridView2.Item(1, dataGridView2.Rows.Count - 1).Value = oledbreader.GetValue(1)
dataGridView2.Item(2, dataGridView2.Rows.Count - 1).Value = oledbreader.GetString(2)
End While
oledbcon.Close()