Solved

Format and Justify FlexGrid Cells

Posted on 2004-04-02
5
882 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month7 days, left to enroll

622 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