I want to add data into different field using the datagridview.This is how i want it to work i have some combo boxes and textboxes on my form and any time i type some in them i want the data to be entered into an appropriate field/column in the datagrid view...........like this if the data in a txtbox goes to a particular column in the datagrid and the the value or data in another combo box goes to another column of the datagrid view.
I am using this code but it is not working for me it is just adding for the fisrt row in the datagrid and it is not moving to another column
After you fill and display your data grid, you can make changes inside the data grid. Add a new button to your form and put the following code in the button click event.
dim dataAdapter as New OleDB.OleDbDataAdapter(sqlStr, connstr)
Dim commandBuilder as New OleDB.OleDBCommandBuilder (dataAdapter)
dim changes as integer = 0
changes = dataAdapter.Update(dt)
if changes >0 Then
MessageBox.Show ( changes & "changed rows were stored in the database")
MessageBox.Show ("No Changes were Made")
The dt in parenthesis is the variable of the data table you created.