473,385 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to change a populated DataColumn UnderlyingSystemType (app)

I have a datagrid with one column that is boolean (it is a checkbox column).
So that myDataTable.Column["myColName"]..DataType.UnderlyingSystemType ==
System.Boolean. For printing purposes, I would like to change this from a
boolean to a string, so that I may manipulate the output to read "X" instead
of true, and "" for false. If I attempt to change the DataColumn type
currently, I get an error stating that I cannot change the type of a column
when it has already been populated.

So, how can I convert the column type, with data in it, from boolean to
string, so that I can change all "true" to "X" and all "false" to ""?

Oh, and this is a windows application, not asp.net...if it matters in this
case.

TIA
-John E.
Nov 16 '05 #1
1 3412
John E.

Why would you do this? If you are printing the information, then I
would think that you are performing the operations to print yourself. When
rendering the data in that column, just perform a transformation at that
point.

How is it that you are printing the data?

Another option would be to hide the column, and add a new column that
has an expression where the text is X if it is true, a space if it is false
(the value in the corresponding column for that row). Check the Expression
property of the DataColumn class for more information on this.

Hope this helps.

"John E." <pl*********@newsgroup.thanks> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have a datagrid with one column that is boolean (it is a checkbox
column).
So that myDataTable.Column["myColName"]..DataType.UnderlyingSystemType ==
System.Boolean. For printing purposes, I would like to change this from a
boolean to a string, so that I may manipulate the output to read "X"
instead
of true, and "" for false. If I attempt to change the DataColumn type
currently, I get an error stating that I cannot change the type of a
column
when it has already been populated.

So, how can I convert the column type, with data in it, from boolean to
string, so that I can change all "true" to "X" and all "false" to ""?

Oh, and this is a windows application, not asp.net...if it matters in this
case.

TIA
-John E.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: SoYouKnowBrig | last post by:
Hi All, I am using Microsoft.ApplicationBlocks.Cache.CacheManager to persist a System.Data.Dataset object. This Dataset object has a DataTable that is created from an existing DataTable using...
2
by: ad | last post by:
I use ado.net to fill a Excel wroksheet into a DataTable. The data in the Excel wroksheet is digital. After the data filled into the DataTable, the DataType of each column is set to Double, but...
3
by: Mike Lerch | last post by:
I have a database with 90-odd true-false values that I need to display on a webform as checkboxes. There are also some other values (numbers and text) that need to be displayed. I'm wondering...
3
by: Miguel Dias Moura | last post by:
Hello, i know how to hide a table according to a condition: <table runat="server" visible='<%# dataSetBibliotecas.FieldValue("Titulo", Container) <> "" %>'... Now I am trying to change the...
3
by: Ken McCrory | last post by:
I have a web form page (.aspx) with 95 label controls that I now need to be text boxes. Is there an easy way to change those to what I want using something like a find and replace or am I stuck...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
2
by: Bob | last post by:
I have a CreatedOn field , datetime, which has GetDate() as the default value in SQL server 2000 table. When I create a new record in the table itself in enterprise manager, the field gets...
3
by: DaveP | last post by:
im Trying to set a Datacolumn type for a new table boolean is not working, What is the correct waty //column.DataType = System.Type.GetType"System.Data.SqlTypes.SqlBoolean"); column.DataType...
2
by: remya1000 | last post by:
i'm using VB.NET. and its a windows application. in my program i need to display a table in datagrid. so i created the table using DataTable and i'm calling that dataTable to dataGrid. and its...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.