Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
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?
Fat kids are harder to kidnap

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...