How to translate grid column from Int to String

M

Morris Neuman

Hello
I am working in VS2008 C#. I have a Windows Form project and have a
Datagridview control. It is displaying data from a database table. One
column has an integer type and represent a time slot. 0=AllDay, 1=Morning,
2=afternoon, 3=First shirft, 4=Second shift, etc. about 15 names in all.

How can I have a column in the data grid show the text value e.g. Morining
instead of just a number from 0 to 15?

I tried to add an unbound column and set the Expression property to a
function:
string GetTimeofDay(int TimeofDay)
But it looks like you cant have a function call in the Expression. Is that
correct/

If so how can I get it done?
 
C

Colbert Zhou [MSFT]

Hello,

The managed support service of the newsgroup CSharp is now available on
CSharp General Forum:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/threads. Would
you please repost the question in the forum with the Windows Live ID used
to access your Subscription benefits? Our engineers will assist you in the
new platform. The article
http://msdn.microsoft.com/en-us/subscriptions/aa974230.aspx introduces more
information about the migration. In the future, please post your C#-related
questions directly to the forums. If you have any questions or concerns,
please feel free to contact us: (e-mail address removed).

Regards,
Ji Zhou
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
 

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

Top