Home > front end >  Input string was not in a correct format & how to rename rowheader datagridview
Input string was not in a correct format & how to rename rowheader datagridview

Time:12-25

please code solution and for rename row header I mean marking the color of the image file I attached Note : for notes I use visual studio 2010

Public Class Form1
    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
        dbConnection()
        Dim indexID As Integer
        x = DataGridView1.Rows.IndexOf(DataGridView1.CurrentRow)
        indexID = Convert.ToInt32((DataGridView1.Rows(x).Cells(0).Value.ToString()))

        sql = "UPDATE ITEM SET ITM= '" & txtFname.Text & "',ITC='" & txtLname.Text & "',QOH='" & cbGender.Text & "' WHERE ID=" & indexID & ""

        cmd = New OleDbCommand(sql, conn)
        cmd.ExecuteNonQuery()
        MessageBox.Show("Successfully Updated...", "Update")
        conn.Close()

        'btnReadDatabase_Click(sender, e);
        retrieveALL()
    End Sub
End Class

Input string was not in a correct format Rename rowheader datagridview object reference not set Thanks roy

CodePudding user response:

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
    dbConnection()
    sql = "UPDATE ITEM SET ITM= '" & txtFname.Text & "',ITC='" & txtLname.Text & "',QOH='" & cbGender.Text & "' WHERE ITC='" & txtLname.Text & "'"
    cmd = New OleDbCommand(sql, con)
    cmd.ExecuteNonQuery()
    MessageBox.Show("Successfully Updated...", "Update")
    con.Close()
    PopulateDataGridView()
End Sub
  • Related