473,664 Members | 2,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Textbox Maxlength mystery

I have set the MaxLength property of a textbox in a form
to 5 at design time. When I change the MaxLength back to 0
during run-time under some condition (for example, after clicking
a command button), I can still only enter at most 5 characters
into the textbox. So how can I reset the textbox to allow
unlimit text to be entered?
Jul 17 '05 #1
9 11440
Bo
Well, it worked fine for me. Why not post your source code, so we can see
what the problem is.

Oh, by the way, when you click the command button, are you creating an all
new instance of the form ? If you are, it will begin life using its design
time setting ( 5 bytes).

g'luck
"Lovely Dola" <do**@webinhk.c om> wrote in message
news:ff******** *************** **@posting.goog le.com...
I have set the MaxLength property of a textbox in a form
to 5 at design time. When I change the MaxLength back to 0
during run-time under some condition (for example, after clicking
a command button), I can still only enter at most 5 characters
into the textbox. So how can I reset the textbox to allow
unlimit text to be entered?

Jul 17 '05 #2
Below is my source code for the Visual Basic form.
Well, when I run the program, I click the button and enter 5 for example.
Now I am limited to enter 5 characters into the textbox.
When I click the button and enter a value to 0, the Maxlength
property of the textbox is reset but I can still enter only 5 characters only.
Can anyone help me to solve this problem?
How can I reset the textbox so that I can enter unlimited text again?
-=-=-=-= SOURCE CODE =-=-=-=-=-

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1725
ClientLeft = 60
ClientTop = 345
ClientWidth = 4140
LinkTopic = "Form1"
ScaleHeight = 1725
ScaleWidth = 4140
StartUpPosition = 3 'Windows Default
Begin VB.CommandButto n Command1
Caption = "Command1"
Height = 495
Left = 270
TabIndex = 1
Top = 975
Width = 1230
End
Begin VB.TextBox Text1
Height = 495
Left = 210
TabIndex = 0
Text = "Text1"
Top = 240
Width = 3510
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSp ace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredI d = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click( )
Dim s$

s = InputBox$("Ente r Maxlength")
If IsNumeric(s) Then
Text1.MaxLength = CLng(s)
End If
End Sub
Jul 17 '05 #3
On 21 Oct 2003 03:14:11 -0700, do**@webinhk.co m (Lovely Dola) wrote:
Below is my source code for the Visual Basic form.
Well, when I run the program, I click the button and enter 5 for example.
Now I am limited to enter 5 characters into the textbox.
When I click the button and enter a value to 0, the Maxlength
property of the textbox is reset but I can still enter only 5 characters only.
Can anyone help me to solve this problem?
How can I reset the textbox so that I can enter unlimited text again?


Funny that - I can enter almost any number

- are you sure that the code you posted behaves like that ?
Jul 17 '05 #4
er*****@nowhere .com (J French) wrote in message news:<3f******* ********@news.b tclick.com>...
On 21 Oct 2003 03:14:11 -0700, do**@webinhk.co m (Lovely Dola) wrote:
Below is my source code for the Visual Basic form.
Well, when I run the program, I click the button and enter 5 for example.
Now I am limited to enter 5 characters into the textbox.
When I click the button and enter a value to 0, the Maxlength
property of the textbox is reset but I can still enter only 5 characters only.
Can anyone help me to solve this problem?
How can I reset the textbox so that I can enter unlimited text again?


Funny that - I can enter almost any number

- are you sure that the code you posted behaves like that ?

Yes, I am sure it is exactly the same.
Have you tried to change MaxLength to 5 and then to 0
during the execution of the program?
Jul 17 '05 #5
On 21 Oct 2003 21:17:41 -0700, do**@webinhk.co m (Lovely Dola) wrote:

<snip>
- are you sure that the code you posted behaves like that ?

Yes, I am sure it is exactly the same.
Have you tried to change MaxLength to 5 and then to 0
during the execution of the program?


Yes, it works fine

My guess is that you are actually entering something that is not
numeric

I strongly suggest that you avoid the use of IsNumeric() it has a
number of surprizing quirks
Jul 17 '05 #6
This is my another form that has the same problem.
This time the MaxLength of the textbox is set to 5 at design time.
When I run the program, I can only enter at most 5 characters which
is fine. When I click the command button, the MaxLength of the textbox
should have reset to zero. But after that I can still enter 5 characters
only. So can anyone please help me to clarify this?
Thanks a lot!

-=-=-=-=-= FORM SOURCE -=-=-=-=-=
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButto n Command1
Caption = "&Reset"
Height = 495
Left = 1740
TabIndex = 1
Top = 1350
Width = 1215
End
Begin VB.TextBox Text1
Height = 510
Left = 195
MaxLength = 5
TabIndex = 0
Text = "Text1"
Top = 345
Width = 4365
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSp ace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredI d = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click( )
Text1.MaxLength = 0 ' <-- numeric zero
End Sub
Jul 17 '05 #7
On 22 Oct 2003 23:48:48 -0700, do**@webinhk.co m (Lovely Dola) wrote:
This is my another form that has the same problem.
This time the MaxLength of the textbox is set to 5 at design time.
When I run the program, I can only enter at most 5 characters which
is fine. When I click the command button, the MaxLength of the textbox
should have reset to zero. But after that I can still enter 5 characters
only. So can anyone please help me to clarify this?
Thanks a lot!

-=-=-=-=-= FORM SOURCE -=-=-=-=-=
VERSION 5.00


I've saved the code as Form1.Frm, added it to a project, and it works
just fine

What version of VB are you using ?
It looks like VB5 which is what I use
Jul 17 '05 #8
It sounds really strange for me...
I am using Visual Basic 6.0 Enterprise Edition.
May be I have to give up working on this problem...

er*****@nowhere .com (J French) wrote in message news:<3f******* *******@news.bt click.com>...
On 22 Oct 2003 23:48:48 -0700, do**@webinhk.co m (Lovely Dola) wrote:
This is my another form that has the same problem.
This time the MaxLength of the textbox is set to 5 at design time.
When I run the program, I can only enter at most 5 characters which
is fine. When I click the command button, the MaxLength of the textbox
should have reset to zero. But after that I can still enter 5 characters
only. So can anyone please help me to clarify this?
Thanks a lot!

-=-=-=-=-= FORM SOURCE -=-=-=-=-=
VERSION 5.00


I've saved the code as Form1.Frm, added it to a project, and it works
just fine

What version of VB are you using ?
It looks like VB5 which is what I use

Jul 17 '05 #9
On 24 Oct 2003 06:25:13 -0700, do**@webinhk.co m (Lovely Dola) wrote:
It sounds really strange for me...
I am using Visual Basic 6.0 Enterprise Edition.
May be I have to give up working on this problem...


This is such a simple thing
If it does not work, then there must be something wrong with your copy
of VB

The only thing that I can think is that it is some 'early' problem
that was fixed by a service pack

The fact that nobody has popped up to say that suggests that it is not
the case.
Jul 17 '05 #10

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

Similar topics

4
2906
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with some textboxes not updating when i a hit save. for example I have this code in my aspx.cs file: declared:
14
7583
by: Adam Clauss | last post by:
I've an application which is using a multiline textbox to log the status of a fairly long procedure. "Updates" are made to the status by calling textbox.AppendText. As my task is fairly lengthy, I go well past the default max text length of the textbox. According to the documentation, setting MaxLength = 0 will increase this to basically the limit of available memory. So, in the form designer, I set the MaxLength property equal to 0. ...
1
466
by: mg | last post by:
I have a MultiLine TextBox (WebForm - C#) with the MaxLength property = 1000 but am able to type in an unlimited number of characters. Is there a way to limit the number of characters that can be typed into this TextBox?
4
8158
by: hardcoded | last post by:
I have a textbox with TextMode set to MultiLine. I also have the MaxLength set to 255. This maxlength value seems to get ignored as the user can enter unlimited characters. Does the multiline textbox not support maxlength? How can I make the work? TIA
3
4853
by: h | last post by:
Hi, I have set my textbox's maxlength property to 1 , however it allow more than one word. Is there any settings that I am missing ? Thanks in advance Hardik Shah
6
8041
Coldfire
by: Coldfire | last post by:
I am having problems with Maxlength of Multiline "Textbox". I have browsed alot to find the solution. Tons of javascripts have been found but they all deal with <asp:textarea >............. and not <asp:TextBox >............. and some of javascripts are 1-------------------------------------------- <script language="JavaScript">
0
3491
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table to white the used CSS to set the opacity to 90 so that you can see the background image through the table. The problem I am having is with the textboxes in the transparent
0
1044
Echooff3
by: Echooff3 | last post by:
Hi All, The one weird thing I noticed about VS2005 is that you can create a dataset via a table adapter and you can drag in the fields in design time to the form, yet the maxlength on the text field remains at the default 32767. Instead of sizing itself to the size of the datacolumn it was mapped to. I don't know if this bugs anyone else, or perhaps I missed something and it does do this automatically but here's a helper function I created...
3
3043
by: engineer | last post by:
Hi, I'm trying to control the maxlength property of a textbox in javascript. But it's not going into effect.This is my code HTML <input type=text id="txt_search_string" class=formtext maxlength=100 /> JavaScript if(var_selection = 'C') document.getElementById('txt_search_string').MaxLength = '6' ;
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
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
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8636
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...
0
5660
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
4186
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
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
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
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.