Solved

FlexGrid

Posted on 1998-06-18
3
549 Views
Last Modified: 2012-05-04
Can someone tell me how to Autosize the Row height in a Flex Grid.  I have a Memo field that will contain a large amount of text and need to be able to read it all.  Either Autosize the row or provide some type of scrolling ability so as to be able to view ALL the data in the field
0
Comment
Question by:warrencc
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 50 total points
ID: 1463711
Here's the easy answer.

Add a label on the same form as the flexgrid.  Set the labels properties:
Name = lblCellText
Caption = "" (Nothing)
Autosize = True
Visible = False

Now when you add data to the grid, use this code (replace nRow and nCol with the row and column you need):
  MSFlexGrid1.TextMatrix(nRow, nCol) = "Now is the time for all good men to come to the aid of their country."
  lblCellText.Width = MSFlexGrid1.ColWidth(nCol)
  lblCellText.Caption = MSFlexGrid1.TextMatrix(nRow, nCol)
  MSFlexGrid1.RowHeight(nRow) = lblCellText.Height + 240

0
 

Author Comment

by:warrencc
ID: 1463712
If I am using column 6 all the time and need this capability in all rows how should I change the (nRow and nCol).  Sorry for needing the detailed explaination.....
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1463713
Create the following subroutine in the form which has the flexgrid:

Private Sub FixFlex()
  Dim nRow As Integer

  lblCellText.Width = MSFlexGrid1.ColWidth(6)

  For nRow = 1 to MSFlexGrid1.Rows - 1
    lblCellText.Caption = MSFlexGrid1.TextMatrix(nRow, 6)
    MSFlexGrid1.RowHeight(nRow) = lblCellText.Height + 240
  Next nRow
End Sub

Now call FixFlex right after adding data to the FlexGrid or after refreshing your data control.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Date Picker 64 bit 32 bit issue 12 53
TT Auto Dashboard 13 91
Child Form in front 4 46
Send outlook email from VBS Script 2 28
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…

813 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

10 Experts available now in Live!

Get 1:1 Help Now