User (Old forums)MemberMay 16, 2007 at 5:35 pmPost count: 23064
I am modifying the resent, new Xceed team’s very nice sample, named DataBinding.
I am using it to work against a SQL Server database, brought into the modified application as a Dataset of Data Tables.
I am using the BindToDataGridCollectionView() procedure to bind the datagrid to a data table, named “Donors”, in my Dataset.
The difference is that originally, Xceed programmers, are binding the datagrid to a data source enclosed in a dll, so it is impossible to see what is going on.
As I said, I am trying to use the same methodology of binding to a Dataset, only my Dataset is originated in a different way.
The binding goes just fine. The thing is, that for some reason, updating the underlying Data Table is not working, and after entering data into the insertion row, and pressing Enter, I get the next exception:
“Object reference not set to an instance of an object.”
I am displaying the modified procedures that are participating in the data binding methodology:
Partial Public Class App
Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
Dim ds As New HW1DataSet
m_donors = ds.Tables(“Donors”)
Private m_donors As DataTable
Public ReadOnly Property Donors() As DataTable
Partial Public Class MainPage
Private Sub BindToDataGridCollectionView()
‘ With this binding, Adding, removing, and modifying data will work.
txtDescription.Text = Data.DataGridCollectionViewText
‘ Reset the grid to its initial state.
‘ Create an Xceed DataGridCollectionView using the Products DataTable as its source.
Dim dataGridCollectionView As DataGridCollectionView = New DataGridCollectionView((CType(Application.Current, App)).Donors.DefaultView)
‘ Bind the grid to the Xceed DataGridCollectionView.
grid.ItemsSource = DataGridCollectionView
Imported from legacy forums. Posted by Lior (had 2017 views)
- You must be logged in to reply to this topic.