Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I had a tough time finding a solution to the above problem. I hope to find a solution here.
I have a datagridview with first three columns as text box and rest two columns as combobox columns.When I add a new row to this datagridview at runtime the values in the previous textbox rows disappear whereas the comboboxes remain as it is in the previous rows.
Please advise on how to retain the values of the previous textbox columns. I've constructed this multicolumn datagridview without binding it to a dataset or a datable.Instead I have constructed the datagridview cell by cell and datagridview columns. A possible solution would be highly appreciated. I will provide any other information from my side if required.

What I have tried:

Searched the entire internet.I 've searched the books but no help.
Posted
Comments
Matias Lopez 27-Aug-18 16:45pm    
If you re-write all the row, the last row disappeared? Tell us more about this error! The definition of the DataGridView, for example.
Arvind61 27-Aug-18 16:56pm    
I've made a function that adds a new row when called.So whenever I call this function called AddNewRow(), It adds one row.The row doesn't disappear, only the entries in the textboxes (and not the combos) in the 'Previous' rows disappear(not the current row). Combos remain same.
Matias Lopez 28-Aug-18 9:22am    
"I've made a function that adds a new row when called."
Where did you call this function (Button, a Windows Form Handle Function, Delegate)? Have you got a cleanning function, (and at the call, maybe clean texBox's)?
If you show the code we could help you better!
Arvind61 27-Aug-18 17:00pm    
if you want more info please let me know.
Richard MacCutchan 28-Aug-18 5:31am    
You need to show the code that does the insert. We cannot guess how those text boxes are being cleared.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900