Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

Is there any way to have the rows of MSHFlexGrid auto size to word wrap text height?

Trying to find a way of getting the rows in an MSHFlexgrid to autosize to the content of their row which contains long string variables and has the word wrap set to true.
0
Fuisseran
Asked:
Fuisseran
1 Solution
 
SethiCommented:
No way. Use third party grid controls from www.componentone.com to achieve what you want.
0
 
venkatravi_78Commented:
Private Sub widtha()
    Dim INTROW As Integer
    Dim INTCOL As Integer
   Dim aryWidths() As Double
   ReDim aryWidths(MSHFlexGrid1.Cols - 1)
   For INTROW = 0 To MSHFlexGrid1.Rows - 1
       For INTCOL = 0 To MSHFlexGrid1.Cols - 1
           If Form1.TextWidth(MSHFlexGrid1.TextMatrix(INTROW, INTCOL)) > aryWidths(INTCOL) Then
               aryWidths(INTCOL) = Form1.TextWidth(MSHFlexGrid1.TextMatrix(INTROW, INTCOL))
           End If
       Next
   Next
   For INTCOL = 0 To MSHFlexGrid1.Cols - 1
       MSHFlexGrid1.ColWidth(INTCOL) = aryWidths(INTCOL) + 250
   Next
End Sub
call this procedure where ever u want to
0
 
FuisseranAuthor Commented:
Sorry about this I acctually solved the problem myself, for anyone else that needs it here is how I solved it.

I first made a richtextbox on the form and set it's visibility to false then use the folloing code

(i) is the current row which is beign sized
(WrapCalc) is the richtextbox on the form

With FlexGrid
  .TextMatrix(i, 5) = RepairsRS.Fields("RepairState")
  WrapCalc.Text = .TextMatrix(i, 4)
  l = WrapCalc.GetLineFromChar(WrapCalc.Find(Right(.TextMatrix(i, 4), 2), Len(WrapCalc.Text) - 3)) + 1
  If l > 1 Then .RowHeight(i) = 210 * l Else .RowHeight(i) = 240
End With

Thanks for the responses though
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
SethiCommented:
Good way. I appreciate this approach ;-). Just put a Delete this question request in Community Support so that you get your points back.
0
 
FuisseranAuthor Commented:
Does Any one know how to Delete Or Close this question I try to edti it and it says this question can no longer be edited or deleted
0
 
SethiCommented:
There is a Community Support link on the left side. Post a question for 0 points there asking the moderator to delete this question and refund your points.
0
 
CleanupPingCommented:
Hi Fuisseran,
This old question (QID 20558495) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
GPrentice00Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

-->PAQ - with points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
EE Cleanup Volunteer
0
 
YensidModCommented:
Question is PAQ'd and points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Technology Partners: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now