My Powershell Studio runs in a Windows 2008 R2, 64 bits.
I'm trying to show data from an access table in a DataGridView. I'd like to show number data with thousand punctuation. I found the property CellStyleBuilder and here I changed the Format to Numeric. The result is that it shows one row good with the appropiate punctuation and one without the punctuation, it alternates one good and one bad. What's happening?
In a similar situation I show the same data in a TextBox, and here I don't Know how I can change the format to Numeric with the thousand punctuation, or if it'd be better use another control.
Thank you
format for Textbox and DatagridView
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- jramon.r@tv3.cat
- Posts: 25
- Last visit: Tue Jan 11, 2022 4:23 am
Re: format for Textbox and DatagridView
Take a look at this demo. It shows how to format the numbers in a column.
- Attachments
-
- Demo-DGVFrmatting.psf
- (15.98 KiB) Downloaded 236 times
- jramon.r@tv3.cat
- Posts: 25
- Last visit: Tue Jan 11, 2022 4:23 am
Re: format for Textbox and DatagridView
Finally I've found the solution. In the DataGridView I was modifying the property AlternatingRowsDefaultCellStyle, this is the cause it showed me just odd rows good.
With the MaskedTextBox I don't understand it very well, how can I show thousands, because sometimes it can be a number like 1.000 but sometimes it can be 10.000, so the thousand punctuation is not always in the same place, do you know how can I do it?
Thank you
With the MaskedTextBox I don't understand it very well, how can I show thousands, because sometimes it can be a number like 1.000 but sometimes it can be 10.000, so the thousand punctuation is not always in the same place, do you know how can I do it?
Thank you
Re: format for Textbox and DatagridView
There is a pre-defined mask for numeric display.
'{0:N2}' -f 1Mb
Select the N2 mask.
Unfortunately you will have to programmatically set the display as there is no mask for that in standard forms.
'{0:N2}' -f 1Mb
Select the N2 mask.
Unfortunately you will have to programmatically set the display as there is no mask for that in standard forms.
- jramon.r@tv3.cat
- Posts: 25
- Last visit: Tue Jan 11, 2022 4:23 am