Solved

FlexGrid

Posted on 1998-06-18
3
518 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now