[Webinar] Streamline your web hosting managementRegister Today

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

maxLines = Form1.TextShow.Height / Form1.TextHeight("A") ?

I am using
maxLines = Form1.Text1.Height / Form1.TextHeight("A")
 to calculate maximum number of lines that'll fit into  the textbox (without scroll) but it doesnt seem to wrk. I have font set to courier new (western) ,size 9 and the form's scale mode is twips. Any ideas on this ..i thought i had this wrking earlier :- (
0
sambha03
Asked:
sambha03
  • 4
  • 3
1 Solution
 
aelatikCommented:
maxLines = Form1.Text1.Height / Form1.text1.text

The result is based on a "FLAT" & "BORDERLESS" textbox.
0
 
sambha03Author Commented:
Text1 is a textbox right? THe above code is giving:
" Error number  =13"
" Description : Type mismatch"
0
 
aelatikCommented:
Sorry,

Your solution is correct, but you have to set up a flat and borderless textbox. if not your have to use :

maxLines = clng(Form1.Text1.Height / Form1.TextHeight("A"))-1
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
sambha03Author Commented:
Mine is a flat borderless textbox. I resize it using something like:
Me.Height = MDIForm1.ScaleHeight *.8
Text1.Height = Me.Height * 0.4
maxLines = me.Text1.Height / me.TextHeight("A")

Do you see any problem here?
0
 
aelatikCommented:
Post me more of your code, this part works fine.
I'd like to understand what you want to achieve.
0
 
sambha03Author Commented:
I just realised that it wrks if i start a new project but not in my existing project. Thats y I wrote that I thought I had this working earlier. I think its got to do with the scaleHeight,height ,width properties.Let me work on it a bit more and I'll get back.
0
 
TigerZhaoCommented:
maxLines = Form1.TextHeight(Form1.Text1) / Form1.TextHeight("A")
0
 
sambha03Author Commented:
Got it. The original solution worked one of the nested calls was changing the font size in my code.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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