doube click row - fill textboxes

mikerob283

Member
Joined
Feb 15, 2005
Messages
12
Programming Experience
Beginner
i have a category, vendor, part_no, description, cost, markup textboxes. I enter data into those textboxes and click add

add then takes the data from the textboxes and inserts into "inventory" table in a sql server

then refreshes the datagrid showing the table "inventory" w/ added row

now heres my problem

i want to be able to double click or click a row in the datagrid and it takes each column and puts the text back into the text boxes so i can press delete

how do i double click or click a row and it send the information from the grid's row into the right textboxes?

thanks
 
Yes this did work and this is the event i made to make that work just encase anyone else wanted to know, i'll be nice and post my working code so that everyone can benefit unlike others who just say "it's fixed" and don't let everyone in on how it was "fixed"

Thank you very much!

VB.NET:
Private Sub dgParts_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgParts.DoubleClick
 
partID = dgParts.Item(dgParts.CurrentRowIndex, 0) 
 
cbCategory.Text = dgParts.Item(dgParts.CurrentRowIndex, 1)
 
cbVendor.Text = dgParts.Item(dgParts.CurrentRowIndex, 2)
 
txtPartnumber.Text = dgParts.Item(dgParts.CurrentRowIndex, 3)
 
txtDescription.Text = dgParts.Item(dgParts.CurrentRowIndex, 4)
 
txtCost.Text = dgParts.Item(dgParts.CurrentRowIndex, 5)
 
txtMarkup.Text = dgParts.Item(dgParts.CurrentRowIndex, 6)
 
End Sub
 
Back
Top