By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,470 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,470 IT Pros & Developers. It's quick & easy.

How to set textbox size to fit a number of characters and lines

P: 23
I want i textbox to fit a specic amount of chars and lines. I'm using font Courier New, where all the letter has the same width. Since different DPI-setting changes the font-size I want to set the textbox width to fit a specific amount of characters when the textbox is loaded.

Any suggestions?

I've tried to use MeasureSstring but thats not wokring 100% correct for diffrent number of charcters.
Apr 17 '08 #1
Share this Question
Share on Google+
1 Reply


smartchap
100+
P: 236
Suppose you want 40 characters in a line then may use the following statement:

TextBox1.Width=40*TextWidth("A")
TextBox1.Multiline=True 'may be use in design view.
Apr 17 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.