BUG: eVB: Text Property in Textbox Ignores MaxLength Value (262416)



The information in this article applies to:

  • Microsoft eMbedded Visual Basic 3.0

This article was previously published under Q262416

SYMPTOMS

If the TextBox control contains a string greater than the MaxLength value, the entire string is still displayed.

RESOLUTION

Step-by-Step Workaround

  1. Open Microsoft eMbedded Visual Basic 3.0.
  2. Create a new Windows CE for the Pocket PC project. Form1 is created by default.
  3. Add a TextBox control and a CommandButton control to the form.
  4. Set the MaxLength property of the TextBox to 3.
  5. Add the following code:
    Private Sub Command1_Click()
        Text1.Text = "New Text"
    End Sub
    
    Private Sub Text1_Change()
        If Len(Text1.Text) > Text1.MaxLength Then
            Text1.Text = Mid(Text1.Text, 1, Text1.MaxLength)
        End If
    End Sub
    					
  6. Run the application on the device or the emulator, and click the CommandButton.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open Microsoft eMbedded Visual Basic 3.0.
  2. Create a new Windows CE for the Pocket PC project. Form1 is created by default.
  3. Add a TextBox and a CommandButton to the form.
  4. Set the MaxLength property of the TextBox to 3.
  5. Add the following code:
    Private Sub Command1_Click()
      Text1.Text = "New Text"
    End Sub
    					
  6. Run the app on the device or the emulator, and click the CommandButton. Note that the string "New Text" is placed in the TextBox despite the MaxLength property setting of 3. Setting the MaxLength property should only display the number of characters specified inside the TextBox.

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kbBug kbDSupport KB262416