I'm using infragistics 10.1.20101.1007 with Visual Studio 2010 and VB.Net
I have a winforms app that binds several controls (mostly ultraTextEditor) to a datatable. The text boxes work exactly as I would expect them to, but the ultracheckeditor is not. It shows the data correctly, but the databinding events that keep other bound objects in sync do not happen initially. Only after the first change does the checkbox begin behaving like I would expect. Am I doing something wrong? Is this a bug in the ultracheckboxeditor? Any suggestions?
Thanks,Tony
To duplicate the issue, create the sample app as detailed below (code doesn't paste so well).
Run the app. Note the data in the grid. Modify the text in the text box noting that each keystroke updates the grid.
Run The app. Then modify the checkbox data with a single click. Note that the grid data does not update. Click the checkbox again to modify the value. Now, the grid will stay in sync with the checkbox.
Example App: Need a winforms app with an ultragrid, ultracheckeditor, and ultratexteditor
Example Code:
Public Class Form1Dim _DtData As New DataTableDim _dataLoaded As Boolean = False
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load BuildData() BindData() _dataLoaded = TrueEnd Sub
Private Sub BuildData() Dim col1 As New DataColumn("BitColumn", GetType(Boolean)) Dim col2 As New DataColumn("TextColumn", GetType(String))
_DtData.Columns.Add(col1) _DtData.Columns.Add(col2)
Dim row1 As DataRow = _DtData.NewRow row1.Item("BitColumn") = 1 row1.Item("TextColumn") = "True Value"
Dim row2 As DataRow = _DtData.NewRow row2.Item("BitColumn") = 0 row2.Item("TextColumn") = "False Value"
Dim row3 As DataRow = _DtData.NewRow row3.Item("BitColumn") = 0 row3.Item("TextColumn") = "Another False Value"
_DtData.Rows.Add(row1) _DtData.Rows.Add(row2) _DtData.Rows.Add(row3) _DtData.AcceptChanges()End Sub
Private Sub BindData() Me.UltraGrid1.DataSource = _DtData Dim bndChecked As New Windows.Forms.Binding("CheckedValue", _DtData, "BitColumn") Dim bndText As New Windows.Forms.Binding("Text", _DtData, "TextColumn") bndText.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged bndChecked.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged Me.UltraCheckEditor1.DataBindings.Add(bndChecked) Me.UltraTextEditor1.DataBindings.Add(bndText)End Sub
Private Sub UltraCheckEditor1_CheckedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UltraCheckEditor1.CheckedValueChanged If _dataLoaded Then Me.BindingContext(_DtData).EndCurrentEdit()End Sub
Private Sub UltraTextEditor1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UltraTextEditor1.ValueChanged If _dataLoaded Then Me.BindingContext(_DtData).EndCurrentEdit()End Sub
End Class
Hi Tony,
It's hard to build a project from a code snippet, because there are too many unknowns, like the version of Visual Studio, the version of the controls, etc.
Can you create a small sample project and attach it here so I can take a look?
To attach a file to your post, just go to the Options tab.