473,397 Members | 1,969 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,397 software developers and data experts.

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 11422
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.com> wrote in message
news:ff*************************@posting.google.co m...
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.CommandButton 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_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
Dim s$

s = InputBox$("Enter 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.com (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.btclick.com>...
On 21 Oct 2003 03:14:11 -0700, do**@webinhk.com (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.com (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.CommandButton 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_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = 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.com (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.btclick.com>...
On 22 Oct 2003 23:48:48 -0700, do**@webinhk.com (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.com (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
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...
14
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,...
1
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...
4
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...
3
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
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...
0
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...
0
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...
3
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.