Solved

MSFlexGrid alignment problem in VB 6.0

Posted on 2008-09-29
3
1,371 Views
Last Modified: 2013-12-26
How do I align Flexgrid fixed header to left in VB 6.0 ?


Code of my flexgrid: 
.Rows = 2
.FixedRows = 1
.FixedCols = 0
.Rows = 2
.TextMatrix(0, 0) = "Issue Date"
.ColWidth(0) = 1150
.TextMatrix(0, 1) = "Rate 360"
.ColWidth(1) = 1050
.TextMatrix(0, 2) = "Rate 180"
.ColWidth(2) = 1050
.TextMatrix(0, 3) = "Rate 5/1"
.ColWidth(3) = 1050
.TextMatrix(0, 4) = "Rate 1/1"
.ColWidth(4) = 1050

Open in new window

0
Comment
Question by:sivachirravuri
[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
3 Comments
 
LVL 38

Accepted Solution

by:
PaulHews earned 125 total points
ID: 22611553
To make a column left aligned, you would use the ColAlignment property.

If you need to align particular cells without aligning the entire column, use the .CellAlignment property.

The constants don't come up in intellisense, but they are listed in the help.
Constant Value Description
flexAlignLeftTop 0 The cell content is aligned left, top.
flexAlignLeftCenter 1 Default for strings. The cell content is aligned left, center.
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 Default for numbers. The cell content is aligned right, center.
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.


Option Explicit
 
Private Sub Form_Load()
Dim i As Integer
With MSFlexGrid1
.Rows = 2
.FixedRows = 1
.FixedCols = 0
.Cols = 5
.TextMatrix(0, 0) = "Issue Date"
.ColWidth(0) = 1150
.TextMatrix(0, 1) = "Rate 360"
.ColWidth(1) = 1050
.TextMatrix(0, 2) = "Rate 180"
.ColWidth(2) = 1050
.TextMatrix(0, 3) = "Rate 5/1"
.ColWidth(3) = 1050
.TextMatrix(0, 4) = "Rate 1/1"
.ColWidth(4) = 1050
 
For i = 1 To 4
    .ColAlignment(i) = flexAlignLeftCenter
Next
End With
End Sub

Open in new window

0
 
LVL 5

Author Closing Comment

by:sivachirravuri
ID: 31501155
Thanks, I already solved. Your comments was correct.
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 22615850
>Thanks, I already solved. Your comments was correct.

I gave you a complete and accurate solution.   Why do you consider it worth only a B grade?

Please see the grading information:
http://www.experts-exchange.com/help.jsp#hi403



0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

628 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