User (Old forums)MemberSeptember 16, 2003 at 1:56 pmPost count: 23064
Using VB.NET. When the user enters info into the datagrid, I want him to be able to click a SAVE button to save the data without having to press the ENTER key after entering the data. Does anyone know how to force the grid to save data programatically?
Imported from legacy forums. Posted by DimondWoof (had 7477 views)User (Old forums)MemberSeptember 17, 2003 at 3:57 pmPost count: 23064
Yes, all you need to do in your “Save” button is to Call EndEdit on the CurrentCell and then save :
If TypeOf GridControl1.CurrentCell Is Xceed.Grid.DataCell Then
Thats it ! 🙂
Imported from legacy forums. Posted by Matt (had 488 views)User (Old forums)MemberSeptember 17, 2003 at 4:55 pmPost count: 23064
No, that didn’t work. When the system tries to resolve the line
If TypeOf gcPrimary.CurrentCell Is Xceed.Grid.DataCell Then
it comes back as false and therefore doesn’t process the rest of the code. If I bypass that line and try to run the code anyway, I get:
Specified Cast is not valid (InvalidCastException)
from the line
Imported from legacy forums. Posted by DimondWoof (had 420 views)User (Old forums)MemberSeptember 17, 2003 at 10:03 pmPost count: 23064
Oups, strange I did test this before I replied to the thread. I will take a look at this and get back to you shortly.
Imported from legacy forums. Posted by Matt (had 700 views)User (Old forums)MemberSeptember 18, 2003 at 9:17 amPost count: 23064
I double checked and everything works fine on my end. It is normal that you get an InvalidCastException in the case where you are trying to cast to an invalid type. Is it possible that you are on a row other than a DataRow when you press on the Save button to commit your changes?
I will send you the sample application that I am using via email.
Imported from legacy forums. Posted by Matt (had 514 views)User (Old forums)MemberSeptember 18, 2003 at 11:27 amPost count: 23064
I enter the grid, the 3rd column is the only one that is not read-only. I type text into that column and then I click on the save button. I do no other steps between those. This happens with a NEW row in the grid but not while editing an existing row in the grid.
How do I save a NEW row?
Imported from legacy forums. Posted by DimondWoof (had 439 views)User (Old forums)MemberSeptember 25, 2003 at 2:30 pmPost count: 23064
Here is what I do.
I do the same for all the datarows. Only one row can be edited at a time, so break after you find the first row being edited.
foreach(DataRow dRow in myGrid)
I know this is C#, but you get the picture.
Imported from legacy forums. Posted by MBonafe (had 486 views)User (Old forums)MemberSeptember 25, 2003 at 6:36 pmPost count: 23064
Thank you VERY much. Believe it or not, this is what I derived out of your C# example for VB:
If CType(gcPrimary.CurrentRow, Xceed.Grid.InsertionRow).IsBeingEdited Then
But it works great. The only thing I had to do is check for an InvalidCastException for when the user tries to save with nothing in the row. I could probably test for it somehow, but This was the easy way to deal with it.
Imported from legacy forums. Posted by DimondWoof (had 494 views)User (Old forums)MemberOctober 9, 2003 at 7:01 pmPost count: 23064
Thanks to all involved in this thread. I am trying to implement the same fix on my first grid.
I am new to VB.Net and Xceed. The grid is the keystone of my entire app. I really like the product because is is fast and very very robust. As a newbie I am really having to struggle (ask Pierre-Luc) with the basics.
Here is my basic philosophical question:
Why doesn’t the XCeed documentation include a functional “Grid For Dummies” section that walks neophites through the things we all want, like Fill a grid, add a new row, initialize the cells where the values are predictable, let the user edit it, Save it, Delete it?
I am about to get there after a monumental 2 week struggle, but I was hoping it would be a lot more clearly documented.
Imported from legacy forums. Posted by Clay Rankin (had 670 views)User (Old forums)MemberOctober 10, 2003 at 10:17 pmPost count: 23064
Thank you for you comments ! Indeed we will retouch our helpfile and make it more user-friendly as possible. However, It is always a pleasure to help you real time on the phone :).
Imported from legacy forums. Posted by Matt (had 357 views)User (Old forums)MemberAugust 9, 2007 at 3:45 pmPost count: 23064
Here’s the same thing in VB, which worked for me.
For Each row As Xceed.Grid.DataRow In gcAccountDetail.DataRows
If row.IsBeingEdited Then
Imported from legacy forums. Posted by Dwight (had 8913 views)
- You must be logged in to reply to this topic.