Solved

Format and Justify FlexGrid Cells

Posted on 2004-04-02
5
856 Views
Last Modified: 2006-11-17
Hi Experts,
  I am using a Flex Grid that has text in the first column and then numbers in the rest of the columns.  There are two rows of headers as well.  My problem is that sometimes the numbers will be in dollars, sometimes in percent, sometimes just a plain number, and occasionally it will actually be TEXT.  I need them to be formatted correctly based on info from an array that I have AND I need all columns (other than the first column and except for the first two rows) to be right justified regardless of whether it's a number or text.  How can I accomplish this?
  Why is it that the flexgrid puts all numbers right justified and then text left justified if everything in a flex grid is text anyway??
Thanks in advance for the help!
-Ren
0
Comment
Question by:Ren
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Xentor_
ID: 10743121
For idx = 1 to flex.Cols.Count - 1
  flex.ColAlignment(idx) = flexAlignRightCenter
Next idx

That'll right-justify everything except the first column.  I don't remember if it affects fixed rows, but you can always specifically set the alignment of the first two rows to something else.
0
 
LVL 3

Accepted Solution

by:
santosh26676 earned 500 total points
ID: 10756941
I think You need to first set the alignment for all the cols (except first) to right and then modify the individual cells of the first two rows to set the alignment to center.

0
 

Author Comment

by:Ren
ID: 10775246
Good call santosh, that was quick and easy!  After a bit of research, I found that MSFlexgrid.ColAlignment(intCTR) = flexAlignRightCenter worked well.
-Ren
0
 

Author Comment

by:Ren
ID: 10775289
santosh,
I went ahead and gave you the points, I was trying to catch up on a few open questions and forgot about the main part of this question.  I don't suppose you know how to format individual cells in currency, 000's or percent, do you?
-Ren
0
 
LVL 3

Expert Comment

by:santosh26676
ID: 10780774
Yes I can answer your next question too. but will I get some more point.

Just Kidding!! I will send you the code to do this.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now