We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Insert Row to DataGrid

Hi I have two questions (problems) 1. I am using the following code to add a new Row. It does add a new row to my Datagrid and it lets me add data to it, when I move to the next row it deletes all the data from this new row and moves the blank row one down and replaces it with the older row. Then it does not accept any data when you write into the cells of this row. Maybe I need to add some extra line of code to this. Can some help please? Thanks Dim dr as Datarow Dim dt as New Datatable() = mydataSet.tables(0) dr = dt.NewRow If myGrid.IsSelected(myGrid.CurrentRowIndex) Then dt.Rows.InsertAt((dr, myGrid.CurrentRowIndex) dt.AcceptChages() Else msgBox("Select a row first") End If 2. If I close my data Grid Window how can I know whether my Data Grid was Modified? Thanks for taking the time to help

Live Chat Icon For mobile
Up arrow icon