Solved

Setting a column header italic in MSFlexGrid

Posted on 2000-02-16
8
915 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
[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
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

739 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