Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

Datagrid.columns

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Soulless - 05 Oct 2007 15:32 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.
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"] )

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.