473,657 Members | 2,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Character count in textbox

Hi Folks,

I am trying to set up some code that will provide a character count
for the text entered into a textbox on my form. I am coding in VB.Net
using visual studio 2003 - web appliaction.

I have sorted the VB code, which when execute via a command button it
updates the label.

Private Sub txtcomment_Text Changed(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles TextBox1.TextCh anged

Label1.Text = TextBox1.MaxLen gth - TextBox1.Text.L ength
End Sub

I want to run this code dynamically so that the update happens in rel
time, however I cant seem to get any compatable Javascript that works
with text changed.

Does anyone have any ideas??

Thanks in advance,

Simon
Dec 12 '07 #1
2 10781
Guys,

I have finally found a solution. There is a custom C# control that
councts words and characters available for free at
http://aspnet.4guysfromrolla.com/articles/103107-1.aspx .

Thanks,

Simon

Dec 12 '07 #2

"si_owen" <s.****@sstaffs .gov.ukwrote in message
news:b4******** *************** ***********@s8g 2000prg.googleg roups.com...
Hi Folks,

I am trying to set up some code that will provide a character count
for the text entered into a textbox on my form. I am coding in VB.Net
using visual studio 2003 - web appliaction.

I have sorted the VB code, which when execute via a command button it
updates the label.

Private Sub txtcomment_Text Changed(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles TextBox1.TextCh anged

Label1.Text = TextBox1.MaxLen gth - TextBox1.Text.L ength
End Sub

I want to run this code dynamically so that the update happens in rel
time, however I cant seem to get any compatable Javascript that works
with text changed.

Does anyone have any ideas??
To be dynamic, you should use javascript instead of making a trip to the
server every time something grunts.
Dec 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5976
by: Walter Brunswick | last post by:
Is there any way to iterate through a sequence of characters to find N consecutive equivalent characters? So, for example, the string "taaypiqee88adbbba" would return 1 if the number (of consequtive characters) supplied in the parameters of the function call was 2 or 3, because "a", "e", 8, and "b" is repeated 2 or 3 times. Thanks for any assistance. W. Brunswick.
9
2534
by: refer_to_website | last post by:
My VB.NET web application has a textbox where the user is allowed to enter up to 50 characters. I have a label on the form next to the textbox that tells the user how many remaining characters he can enter. This label needs to be refreshed on the fly each time the user types a character into the text box. Eventually, the user will click the SAVE button on the web form, and the data he entered in the text box will be written to the...
9
10097
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, possibly a custom validator with a function written in javascript. Has anyone done this? Does someone have an example? Regards
3
26222
by: Kuups | last post by:
Hi! I have a question regarding the count if character within a string like for example I have a string of e.g. 123#123# I would like to determine what is the code? of getting the # sign
3
2961
by: BJ | last post by:
Ever see those nifty sites that allow you to type text into a single or multi line text box and decrement from the maximum number of characters to 0? This lets the user know they are approaching the maximum length to the textbox. Does anyone have any examples of this script? It is for an ASP.Net page that has some client side java script. TIA
3
10150
by: Venkatachalam | last post by:
Hello, I am reading a Column form the DataTable and have to display in the RichTextBox/TextBox (With Multi-line). When I try to do so: The width occupied by each charaters are not same and that causes column alignment problem. For ex.
4
1268
by: Anthony P. | last post by:
Hello Everyone, I'm building an application and need to keep track of the amount of text in a textbox to make sure the user knows how many characters they have left to type. I've set the textbox's max length to 120 and that works fine. Now, I have a label that displays characters remaining in the textbox. For each keypress I am decrementing the counter (and label value) by one and when the user presses the backspace key, I am...
40
1770
by: Tameem | last post by:
hi my name is tameem. i am a new c programmer. in a c program i want to give input ""tameem"" and the output will be ""xdphhp"" in a short: the character ""a"" will be replaced by ""d"" i can convert only a character.so how can i convert a word or a sentence my character convert program is given below: #include<stdio.h>
4
3797
by: HenrikL | last post by:
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...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.