Me.DataGrid1.DataSource = dt.Select("SubTabID = " & iSubTab.ToString)
And now it seems to be working fine. Gah!
"Beverley" <ali_webitems@hotmail.com> wrote in message
news:eT3G%230Y0EHA.1256@TK2MSFTNGP10.phx.gbl...
> I'm trying to do pretty much exactly what is described here:
>
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q992q >
> I have a datagrid which is bound to some data (surprise). Then I have some textboxes,
> which I want to display the current data shown in the datagrid. The guts of the code
that
> accomplishes this is:
>
> 'Get the table
> Dim dt As DataTable = TCE.db.TheDataset.Personnel
>
> 'Set the data grid to this table (filtered to the current sub tab)
> Me.DataGrid1.DataSource = dt.Select("SubTabID = " & iSubTab.ToString)
>
> 'bind the textboxes
> With Me.txtCategory.DataBindings
> .Clear()
> .Add("Text", Me.DataGrid1.DataSource, "Category")
> End With
> 'follow same procedure for all other text boxes......
>
> My problem is if any of the data is null, it dies. It cannot seem to handle a null in
> databinding. The grid handles it fine, but if (for example) the Category is null for
one
> of the rows, it won't update the text boxes to that row at all (not even the other
> non-null rows). I can click on any other row, as long as it is fully filled out.
>
> The above code is only run once, so I'm not sure where I should be checking for nulls,
or
> whether I should just mangle my SQL statement by wrapping IsNull around each and every
> field (please don't tell me to do it this way!) :)
>
> Thanks much
>
> Beverley
>
>