Link to home
Create AccountLog in
Avatar of Eric Burton
Eric BurtonFlag for United States of America

asked on

URGENT! VB.NET -- Need to edit current DataGridViewRow

Hi everyone,

How can I modify the following code so that I can edit the CURRENT DataGridViewRow instead of adding a new one?


Dim newCustomersRow As NorthwindDataSet.CustomersRow
newCustomersRow = NorthwindDataSet1.Customers.NewCustomersRow()

newCustomersRow.CustomerID = "ALFKI"
newCustomersRow.CompanyName = "Alfreds Futterkiste"



Avatar of Gautham Janardhan
Gautham Janardhan

i don't think dataset/datatable has a current data row, you will need to get the currency manager from  datagrid and get current from that

CurrencyManager cm =
  (CurrencyManager)yourgrid.BindingContext[yourgrid.DataSource, yourgrid.DataMember];
DataRowView rowView= (DataRowView)cm.Current;
DataRow currentRow= rowView.Row;
currentRow.CustomerID = "ALFKI"
currentRow.CompanyName = "Alfreds Futterkiste"
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
Flag of Greece image

Link to home
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer