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

Problem with datagrif

Hi I am facing following prob in datagrid in VB.NET Problem - 1 i have a datagrid bound to a datatable in a winform, i am using datagrid to accept child entries of a invoice, i have initialised datatable with 25 blank rows, 8 column in datatable but on grid only 4 are shown (columns like ID's has been hidden), i am also simulating Enter key as Tab to goto next field in dataentry with ProcessCmdKey. Now when user is on row 0 and makes entry in each cell and presses enter to goto next field on the 4th col which is last column in grid on pressing enter on grid we can see that foucs is on next row that is row 1 col 1, however following line gives gives wrong row number (1 less than actual) in Enter event of first cell. Dim iCurrCellRow As Integer = DataGrid1.CurrentCell.RowNumber if u click through mouse on first col cell gives proper row number, only when user comes through keyboard by pressing enter in previous row last column gives incorrect row number. Problem - 2 how to handle insert, delete in datatable when user selects to do the same on grid. i would also like to know about any links, articles, sample code, book name on datagrid handling in Winform, there are lot on ASP.NET web form, but very less on Winform thanks in advance deepak

Live Chat Icon For mobile
Up arrow icon