473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to count character in a textbox, xbap application

Hi!

I have textbox that have fixed size in GUI and I need to know how many character I can put into it.

For example, the textbox can contain 5 character in GUI and I wan to check if this string "234567.333" is not to large for the textbox, if it is then I wan to highlight the textbox.text = "#####" (like exel).

Is there any easy way to count how many character a fixed size textbox can contain? Cant use Graphics.MeasureString method cause it is a xbap application.
Oct 26 '09 #1
4 3785
tlhintoq
3,525 Expert 2GB
Is the font also a fixed width, like courier?
If you are using a variable width font like Ariel then the short answer is 'no'.
MMMMMMMMMMMMMMMMMMMM
IIIIIIIIIIIIIIIIIIII

Expand|Select|Wrap|Line Numbers
  1. MMMMMMMMMMMMMMMMMMMM
  2. IIIIIIIIIIIIIIIIIIII
See the difference?
Oct 26 '09 #2
The font is arial or times
Oct 26 '09 #3
tlhintoq
3,525 Expert 2GB
@HenrikL
Those are both proportional-width fonts. (Not fixed width)
So you can't predict the number of characters that will fit since more skinny characters will fit than fat characters.
Oct 26 '09 #4
GaryTexmo
1,501 Expert 1GB
What you might be able to do, and I stress *might* (because I don't really know much about XBAP other than what I just wikipedia'd right now), is write to a hidden auto-size label object and see if the width of that label is larger than your text box (ie, pixel width).

I know, I know, total hack (if it even works) but hey, it never hurts to try and be creative :D
Oct 27 '09 #5

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

Similar topics

9
by: Jerry | last post by:
In limiting textbox input to 500 characters I would like to include a dynamic count of characters input while the user is typing into a textbox. This would obviously be a client side control,...
5
by: dgk | last post by:
From what I've been reading, an XBap application could be really good for a place like mine where everyone will have a PC that has framework 3 loaded and runs IE. The app is downloaded from a...
0
by: Masudur | last post by:
Hi, I been searching net for a while for solution but unable to work. i have few questions regarding xbap applicaion. first of all can i really use wcf service with xbap browser application in...
3
by: =?Utf-8?B?SXpvcmljaA==?= | last post by:
I observed that WCF client running inside Full Trust mode XBAP application can't read byte array over 16384. If return result is bigger than that size, then client simply get null or Nothing in VB...
2
by: Steven Tang | last post by:
It seems that we can only embed XBAP Iframe to create a WPF gadget, the WPF application will not work at this time (I tried Stanimir's demo, it is not different to a standalone WPF application, it...
0
by: | last post by:
It seems that we can only create a WPF gadget by embed XBAP Iframe, the WPF application will not work at this time (I tried Stanimir's demo, it is not different to a standalone WPF application, it...
2
by: =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post by:
I'm creating a XBAP application and want it take some input from webpage dynamically? what is the best way? how to do it? Best Regards Steven -- ======================= Steven Tang SYWWUYU)
4
by: =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post by:
I'm creating WPF gadget by embed XBAP Iframe: 1. Is it possible that create Pure WPF (non-XBAP) which could auto dock into the Vista sidebar when dragging the WPF application near Sidebar? 2. My...
5
by: =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post by:
It seems that one page XBAP whose Unloaded event never get called, I need put some clearing stuff (I.G stop dispatcher time) when user close browser, it unload event doesn't work, where shall I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.