Hi, I am seeking out information on working with 'columns' in code.
for instance I have a column on a datatable that is of type boolean.
In code I wish to test to see if that column is true or false.
I think typing the code:
if ( datagridname.columns[columnname] = true) do something
would work, but it give a compile error.
How should I handle trying to test a boolean value in code?
Thanks!!!
Soulless - 05 Oct 2007 16:46 GMT
> Hi, I am seeking out information on working with 'columns' in code.
> for instance I have a column on a datatable that is of type boolean.
[quoted text clipped - 9 lines]
>
> Thanks!!!
If I enter:
dataGridDaemons.Rows.Add();
no row is added. Any ideas?
I understand that I am better off adding the row programatically
through the datatable. Any ideas on that?
Ignacio Machin ( .NET/ C# MVP ) - 05 Oct 2007 21:06 GMT
Hi,
> Hi, I am seeking out information on working with 'columns' in code.
> for instance I have a column on a datatable that is of type boolean.
[quoted text clipped - 3 lines]
>
> if ( datagridname.columns[columnname] = true) do something
Please clarify, you first talk about datatable and then later about a
DataGrid.
In any case you will have to cast from object (that is the type you get from
getting a value) to bool:
if ( true == (bool)DataTable.Rows[0][["columnname"] )