|
-
Dec 4th, 2007, 10:26 PM
#1
Thread Starter
Addicted Member
[2005] Insert value from textbox into datagridview? Code included
I have a list box that is populated with data. When an item from the listbox is double clicked, the value is displayed in a textbox on the form. With the click of the "Change" button, I want to push that textbox value to index 4 in my DGV. Here is what I tried with no luck.
This all occurs on the click event of the Change Button
PHP Code:
For Each row As DataGridViewRow In Form1.GroupDataList.SelectedRows
row.Cells(5).Value = txtSearch.Text
Next
Any ideas why this wouldn't work?
I don't get any errors, but nothing happens either.
-
Dec 4th, 2007, 10:28 PM
#2
Re: [2005] Insert value from textbox into datagridview? Code included
Are there any rows selected in the grid? If you want the cell at index 4 set then why are you specifying index 5 for the column?
-
Dec 4th, 2007, 10:51 PM
#3
Thread Starter
Addicted Member
Re: [2005] Insert value from textbox into datagridview? Code included
Oops, that was a typo. THe first part was also supposed to be "5". Yes, in the DGV it is returning one record, and I select that row.
-
Dec 4th, 2007, 11:03 PM
#4
Re: [2005] Insert value from textbox into datagridview? Code included
My guess is that you're referring to the wrong Form1 instance in your For loop. You're referring to the default instance. If you haven't displayed the default instance then you won't see the change. If this code is in the form itself then you should use Me, not Form1.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|