|
-
December 21st, 1999, 06:33 PM
#1
formatting data in MSHFlexGrid
Does anyone know how you would go about formatting a column of data in a bound MSHflexGrid to display a $000.00 format?
I have a bound MSHFlexGrid to an ado object, with an Access 97 database on the back end. I am displaying one column in the FlexGrid which contains a "monetary" value. I've tried using a text datatype for this field in Access, and defining an input mask property to store the values for this field in a $000.00 format. I've also tried changing the data type in Access to Currency, although I would prefer to store the value as text only. Neither of these approaches work, the column of data is displayed in the MSHFlexGrid as just a line of numbers (23455) with no decimal point and no preceeding $.
Any advice or ideas would be greatly appreciated!!!!
chaseltine
-
December 22nd, 1999, 06:40 AM
#2
Re: formatting data in MSHFlexGrid
You could try something like :
Dim sValue as string
Dim lYourColumnNumber as Long
lYourColumnNumber = 1
With MSHFlexGrid1
.Redraw = false ' makes it about 10x faster !
for lCount = .FixedRows to .Rows - 1
sValue = MSHFlexGrid1.TextMatrix(lCount, lYourColumnNumber)
sValue = Format$(sValue, "$###,###,###.##")
MSHFlexGrid1.TextMatrix(lCount, lYourColumnNumber) = sValue
next
.ColAlignment(lYourColumnNumber) = flexAlignRightCenter
.Redraw = true ' dont forget to do this !
End With
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
December 22nd, 1999, 10:57 AM
#3
Re: formatting data in MSHFlexGrid
Chris,
Thank you!!! Now that I see the code, I'm embarrassed to admit that I wasn't able to figure out how to do it myself. But I guess this close to the holidays, with one last bug fix to make before I can take vacation, I'm too burned out to even think straight.
Have a Merry Christmas, and a Safe and Happy New Year.
chaseltine
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|