Solved

FlexGrid

Posted on 1998-06-18
3
591 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
[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
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

624 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