Print Search Rate
    
   05-05-2004, 5:30 PM
INFO: Programmatically Updating in Bound Mode

When working with SharpGrid in bound mode, developers sometimes need to programmatically change the values that are displayed in SharpGrid and then update these changes to the bound data source. For performance reasons, SharpGrid updates the data source when a user leaves a row. This is significant because it means that in order to programmatically update a row, you need to make it the current row.

Additionally, you should set SharpGrid's .Editing property to True before changing the cell's value and then to False after changing the cell's value. Lastly, you should call SharpGrid's Update method to help ensure that the row's buffer and the data source's record are synchronized.

The easiest way to do this would probably be to set up a method in your project like this:

Private Sub ProgrammaticallyChange(Row As Integer, Col As Integer, value As Variant)
   With SGGrid1
      .Row = Row
      .Col = Col
      .Editing = True
      .CurrentCell.value = value
      .Editing = False
      .Update
   End With
End Sub

Then, any time you want to programmatically change a row, you can just call it like this:

'modify data in recordset programmatically
With SGGrid1
   ProgrammaticallyChange .Row, .Col, "ValueChanged"
End With

Note: Please feel free to use this code in your own application or modify this approach to better fit your needs. If you have any questions or need assistance, please submit a support request.


GrapeCity » Frequently Aske... » SharpGrid FAQ » INFO: Programmatically Updating in Bound Mode
Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.