473,324 Members | 2,511 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,324 software developers and data experts.

Formating a DataGrid column

How do I make a column in a DataGrid have the following fomat

xx.xx

i.e. FormatNumber(??????, 2, TriState.True)

Thank you...
Nov 21 '05 #1
2 1372
"Bruce A. Julseth" <br***********@attglobal.net> wrote in news:
#p**************@TK2MSFTNGP12.phx.gbl:
How do I make a column in a DataGrid have the following fomat

xx.xx

i.e. FormatNumber(??????, 2, TriState.True)


Depends on where your number is coming from, but check out the variants of
decimal.ToString()
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 21 '05 #2
Hi,

Use a numberformatinfo where you define the column for your
tablestyle.

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

Dim pd As System.ComponentModel.PropertyDescriptor =
cm.GetItemProperties()("Qty")

Dim ni As New System.Globalization.NumberFormatInfo

ni.CurrencyNegativePattern = 1

ni.CurrencySymbol =
System.Globalization.CultureInfo.CurrentCulture.Nu mberFormat.CurrencySymbol

Dim colQty As New DataGridTextBoxColumn(pd, "c")

With colQty

..MappingName = "Col1"

..HeaderText = "Qty"

..Width = 75

..FormatInfo = ni

End With

Info on adding Table style to datagrid
http://msdn.microsoft.com/library/de...asicprimer.asp

http://msdn.microsoft.com/library/de...stdatagrid.asp

Number Format info
http://msdn.microsoft.com/library/de...classtopic.asp
Ken

-----------------------
"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
How do I make a column in a DataGrid have the following fomat

xx.xx

i.e. FormatNumber(??????, 2, TriState.True)

Thank you...

Nov 21 '05 #3

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

Similar topics

3
by: Jonas Knaus | last post by:
hi there... i fill my datagrid with a DataTable : DataTable DA = new DataTable(); sqlDA.Fill(DA); dataGridAdresse.DataSource = DA; now i would like to formate my datagrid but i don't know...
1
by: Diogo Alves - Software Developer | last post by:
Hi there, I have a datagrid that have a DateTime Column, that I built with this code: DataGridTextBoxColumn ExcColumn; ExcColumn= dgExc.TableStyles.GridColumnStyles as DataGridTextBoxColumn;...
1
by: Fabiano | last post by:
Please, i have a datagrid with columns binded to a DB. I need to show a specific column like 123.423-12 how can i do this? I tryed to use DataFormat property of the BoundCollumn with no...
1
by: JAPHET | last post by:
I am Trying to Format date in my Datagrid to SHORTDATE format with the following codes, Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As...
3
by: Tina | last post by:
I have a datagrid where I specified {0:###,###,###} at design time. However sometimes I am putting percentages in the grid instead of money and I want to change the formating to {##%}. I've...
2
by: Tim::.. | last post by:
Hi I'm trying to create a pager that allows you to show records by year and month! I am getting close but would really appritiate some help! Can someone please tell me how I convert the value of...
1
by: thechaosengine | last post by:
Hi all, I'm trying to format a date in a bound datagrid. In order to do this I've placed the following as an attribute to the bound column in question: DataFormatString="{0:dd/mm/yyyy}" ...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
0
by: shbrittan | last post by:
I need to have my users type in instructions in either plain text or with imbedded html tags at their choice. The typed data along with other columns are stored in a sql database, then displayed in...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.