Datagrid.columns

  • Thread starter Thread starter Soulless
  • Start date Start date
S

Soulless

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!!!
 
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!!!

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?
 
Hi,

Soulless said:
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


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"] )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top