Solved

FlexGrid

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
consolidate or create a new vba code for performing tasks 5 63
MsgBox 2 47
bit defender blocks good applications 2 82
MS Date Picker 64 bit 32 bit issue 12 49
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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 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…

895 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

18 Experts available now in Live!

Get 1:1 Help Now