Question How to populate DataGridView

Mattrak

New member
Joined
Jan 30, 2016
Messages
2
Programming Experience
Beginner
I am a beginner Vb programmer. I have a DataGridView in my form. When the user enters the product code in column 1, the rest of the columns must get populated with inventory on hand, description of the product and total inventory value (calculated field). I tried with cellentered event but then it goes into a loop. Can any one guide me pls. Appreciate the help!
 
That's the wrong event. Think about it. What does entering a cell have to do with it? What matters is when the value changes in a cell in that first column, so its the CellValueChanged event that you need to handle.
 
Thanks for your help, Yes I should have used the CellValueChanged, I tried that but got an error. So used CellValidation method. Now it worked.
 
Thanks for your help, Yes I should have used the CellValueChanged, I tried that but got an error. So used CellValidation method. Now it worked.

Now you're using the wrong event again, although you can still make it work. CellValidating is for validating the cell whose value has changed, NOT making changes to other cells. You should have addressed what you had done wrong in the CellValueChanged event instead.
 
Back
Top