• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2428
  • Last Modified:

MS Flex Grid problem, vb6 how to justfiy text (center,left,right) in view.


How do you justify text in ms flex grid??  working code if possible...  Thanks!
3 Solutions
bluedragon99Author Commented:
before data is added not after, to make it easier for ya.
Yupp, I face the same problem too. When a string is started with numeric, let says "2 friends", then it will be aligned to right automatically.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Try this:

flexigrid.ColAlignment(index) = flexAlignRightCenter

The rest of the ColAlignment Properties can be found here:
the following are the constants and their values for alignment

flexAlignLeftTop 0 The cell content is aligned left, top.
flexAlignLeftCenter 1 The cell content is aligned left, center. This is the default for strings.
flexAlignLeftBottom 2 The cell content is aligned left, bottom.
flexAlignCenterTop 3 The cell content is aligned center, top.
flexAlignCenterCenter 4 The cell content is aligned center, center.
flexAlignCenterBottom 5 The cell content is aligned center, bottom.
flexAlignRightTop 6 The cell content is aligned right, top.
flexAlignRightCenter 7 The cell content is aligned right, center. This is the default for numbers.
flexAlignRightBottom 8 The cell content is aligned right, bottom.
flexAlignGeneral 9 The cell content is of general alignment. This is "left, center" for strings and "right, center" for numbers

and the code that does it
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = 1
MSFlexGrid1.Text = "left"
MSFlexGrid1.CellAlignment = flexAlignLeftBottom
MSFlexGrid1.Col = 1
MSFlexGrid1.Row = 1
MSFlexGrid1.Text = "right"
MSFlexGrid1.CellAlignment = flexAlignRightBottom
MSFlexGrid1.Col = 2
MSFlexGrid1.Row = 1
MSFlexGrid1.Text = "center"
MSFlexGrid1.CellAlignment = flexAlignCenterBottom

you can set the alignment for a whole column too like lttia1 said
bluedragon99Author Commented:
Thanks great information everyone!!  hope I was fair with the points.
Thanks to you all!

? @_@ ?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now