Saravanan07 Posted May 29, 2009 Posted May 29, 2009 Hello, I'm currently developing a application in VB.Net. I'm using the DataGridView to display my data on the form and I have stored all the records in MS SQL. I have a EDIT button on the module and I need to know how can I populate a selected record into the textboxes from the DataGridView to be edited. Hope you could understand my question. Thank you very much. Below are the code and the error are 'CurrentRowIndex' is not a member of 'System.Windows.Forms.DataGridView'. - Private Sub cmdEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEdit.Click If (gridAdmin.RowCount > 0) Then If MsgBox("Edit this Administrator Details?", vbExclamation + vbYesNo, "Edit Administrator Details") = vbYes Then Call drawerOpen() Call cboOption() detailbox.Visible = True cmdUpdate.Visible = True cmdSave.Visible = False txtName.ReadOnly = True txtUsername.ReadOnly = True txtID.Text = gridAdmin.Rows(gridAdmin.CurrentRowIndex, 0) End If Else dummy = MsgBox("No Administrator Details found!", vbCritical, "Error") End If End Sub Quote
iebidan Posted June 4, 2009 Posted June 4, 2009 I think you know the cell the user is standing at the moment he uses the edit button right?, how many rows or columns your datagrid has? Quote Fat kids are harder to kidnap
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.