Solved

Setting a column header italic in MSFlexGrid

Posted on 2000-02-16
8
860 Views
Last Modified: 2008-02-26
I am trying to set a column header of a MSFlexGrid italic when the form loads for the first time. The grid has only one header row and several columns. I have noticed that even if there is only one row, the value of MSFlexGrid.Row =1.However, when I do the following, I get a runtime error on the 3rd line:

1)MSFlexGrid.Row = 0
2)MSFlexGrid.CellFontItalic = True
3)MSFlexGrid.Row = 1

I would like the Row value 1 which is what it originally is but if I set it back to 1 as in line 3, I get a run time error.

Musleh

0
Comment
Question by:mfarid1
8 Comments
 
LVL 3

Expert Comment

by:MTroutwine
ID: 2527461
What do you have MSFlexGrid.FixedRows set to?
0
 

Expert Comment

by:tcornett
ID: 2527579
Musleh,

If you are getting the error #30009: Invalid Row Value, then it is most likely because your recordset is empty.  If the flex grid only contains the field names and no data (because your recordset is empty) then you cannot go to row 1 becauase it will not exist.  You may want to try putting an If..Then statement in your code to handle this.  For example:

MSFlexGrid.Row = 0
MSFlexGrid.CellFontItalic = true

if rsRecordset.RecordCount > 0 then
  MSFlexGrid.Row = 1
end if

Try this and let me know how it works.

- Tom
0
 
LVL 20

Expert Comment

by:hes
ID: 2527992
In the properties of the grid set rows to 2 and fixed rows to 1
0
 

Author Comment

by:mfarid1
ID: 2528017
To MTroutWine, MSFlexGrid.FixedRows =1

To hes, I don't want to have FixedRows and Rows different. When there is no data I don't want to show an empty row.

To tcornett, you are talking in the context of a recordset. Actually, what I want to know is, if we have a grid with just 1 row and that is a fixed row, how do we set the first column header to italic?

0
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

 
LVL 3

Accepted Solution

by:
MTroutwine earned 50 total points
ID: 2528078
Here is what worked for me.  I created a new project in VB added the MSFlexGrid Control.  Right-click on the control and set both the Rows and FixedRows values to zero... yes you will get a message saying you cannot do that but click OK on it and then click OK on the property sheet to close it.  Next add this code to the form load event:

With MSFlexGrid
    .Rows = 2
    .FixedRows = 1
    .Rows = 1
    .Font.Italic = True
    .Col = 0
    .Text = "Test"
end with

Hope this is what you are looking for!
:>)
0
 

Expert Comment

by:tcornett
ID: 2528082
mfraid1,

If you have just one row, and that row is fixed, then that row is row number 0.  Row number 1 at this time does not exist. So if you want to set it to italic, do what you were doing above but omit the MSFlexGrid.Row = 1 for this line will give an error due to the fact that Row 1 does not exist.

If you want to leave the MSFlexGrid.Row = 1 line in the code, then you may want to try using On Error Resume Next.

Hope this helps and good luck!

- Tom
0
 
LVL 3

Expert Comment

by:MTroutwine
ID: 2528087
One quick mistake in my statement above, after you get the message about the Fixed Rows must be 1 less then the Rows count and click OK to close that messagebox.  Click on the Cancel button on the property page window not the OK button.  Sorry...
0
 
LVL 3

Expert Comment

by:MTroutwine
ID: 2528096
One more thing, to get the message box from the property page you must click the Apply button.  Sorry again.  Having one of those days!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

706 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

17 Experts available now in Live!

Get 1:1 Help Now