473,382 Members | 1,512 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,382 software developers and data experts.

Formatting date in DataGrid

How can I format a date or number in a data grid.
If I want to show a date as "dd/MM/yy" and the column is
set up as a DateTime datatype, how can I have the date
show up in the format I want?
Nov 20 '05 #1
2 894
Hi,

Dim cm As CurrencyManager = CType(Me.BindingContext(dvClient),
CurrencyManager)

Dim pd As PropertyDescriptor = cm.GetItemProperties()("AppointDate")

Dim colDate As New DataGridTextBoxColumn(pd, "dd/MM/yy")

With colDate

..MappingName = "ApointDate"

..HeaderText = "Date"

..Width = 100

End With

Ken

------------------

"Richard Keller" <an*******@discussions.microsoft.com> wrote in message
news:90****************************@phx.gbl...
How can I format a date or number in a data grid.
If I want to show a date as "dd/MM/yy" and the column is
set up as a DateTime datatype, how can I have the date
show up in the format I want?

Nov 20 '05 #2
Thank you for your help,
This worked very well
Richard
-----Original Message-----
Hi,

Dim cm As CurrencyManager = CType(Me.BindingContext (dvClient),CurrencyManager)

Dim pd As PropertyDescriptor = cm.GetItemProperties() ("AppointDate")
Dim colDate As New DataGridTextBoxColumn(pd, "dd/MM/yy")

With colDate

..MappingName = "ApointDate"

..HeaderText = "Date"

..Width = 100

End With

Ken

------------------

"Richard Keller" <an*******@discussions.microsoft.com> wrote in messagenews:90****************************@phx.gbl...
How can I format a date or number in a data grid.
If I want to show a date as "dd/MM/yy" and the column is set up as a DateTime datatype, how can I have the date
show up in the format I want?

.

Nov 20 '05 #3

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

Similar topics

0
by: Chumley the Walrus | last post by:
Inside a datagrid that has editcommandcolumns and such, I'm able to format a date variable with DataFormatString ="{0:d}" to display a properly formatted date of 7/14/2004 instead of 7/14/2004...
4
by: Jesper Stocholm | last post by:
I have a WinForm datagrid that receives data from a DataSet. One of the colums is anm INT-column from the database, and I would like to format these INTs before binding them to the control. I...
7
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is...
0
by: Mike Fellows | last post by:
i have a function (shown below) that accepts a web datagrid and populates it with a dataset when i display my datagrid it shows the date as 00/00/0000 00:00:00 i need to format the time from...
5
by: William Gower | last post by:
I have a datagrid that has a column that displays a date. The date is currently being displayed in a long format, I want to format it to display in short format. How do I do that in a datagrid?
5
by: tshad | last post by:
I have been trying to figure out what the Datagrid is doing to create its formatting. I found that some of my Datagrids have a 3D type of border and sometime it has a straight line. I finally...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
5
by: Mike Fellows | last post by:
I have a dataset wich contains 3 columns i wish to format the 3rd column which contains a date field but it shows the date as dd/mm/yyyy 00:00:00 i need to remove the time part of the data (i...
2
by: John Dann | last post by:
I've got what seems to be a common problem with the DataGrid control - I want to display a dataset one of whose columns (always the first column) is a datetime column. But only the date displays...
2
by: psycho | last post by:
in sqlserver in date is stored in a particular format. Date and time are stored in same column. so if i want to display only date or only time in the datagrid is there any solution?
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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.