Changing values in a DataGridView textbox

phudgens

Member
Joined
Oct 3, 2012
Messages
5
Programming Experience
10+
VS Express 2012
I hope I've got the right forum. I am using the following code to write elements of my DataGridView out to a text file for future import.

ParmWriter.Write("C1R1: " & DataGridView1.Item(0, 0).Value)

My DatagridView has 5 columns and 5 rows. 3 of the columns are ComboBoxes, and 2 are TextBoxes. When I change a value in a ComboBox the changed value is correctly written to my text file. But, if I change a value in one of the TextBoxes, the new value is not written to the text file, in fact all I get is the leading "C1R1:". How can I get VS to recognize and retain the changed values in my DataGridView?

Thanks,
Paul Hudgens
Denver
 
The code you have shown is always going to write out the Value of the cell in the first column of the first row. Is that actually all the code you have or do you actually have a pair of nested loops that will write out the whole grid?
 
Sorry -I should have mentioned that this is just one of several similar lines that write out each element of a 5 column by 5 row DataGriidView. Only the values that are changed in the text boxes of the DGV don't get written out - just blank spaces.

thanks,
Paul Hudgens
 
I can't think of any reason that that would be the case. Can you try to replicate it in a simple test project and, if you can, provide us with steps to follow to do the same?
 
Upon further digging this morning, I discovered that for the particular TextBox in my DataGridView that I was having problems with, I had (somehow) set the NullValue property to the very string to which I was trying to change the TextBox value. So when I tried to output the values, a blank (null) was being written instead of the desired string. My apologies for the confusion, and thanks for the input.

Paul Hudgens
Denver
 
Back
Top