Newbie Needs Help on Textbox 
Author Message
 Newbie Needs Help on Textbox

I need help!  
Why does the cursor not ALWAYS start in the left most position
when typing text in a TextBox?  I've tried everything I can think
of.  I've got the MaxLength set in each TextBox to the length
of a field in the database.  But every time I type data in say,
a TextBox with a MaxLength set to 15, I can only type 14 characters.
The same for a TextBox set to 1.  As soon as I try to type a character
the bell rings and I can type nothing?

I tried the following but the problem still exists.

Private Sub Text1_GotFocus(Index As Integer)

    Text1(Index).SelStart = 0

End Sub  

                         Thanks,

                                    Magic



Fri, 16 Apr 2004 00:47:05 GMT  
 Newbie Needs Help on Textbox

Quote:

>of a field in the database.  But every time I type data in say,

Ah... database.  Is/are your textboxes bound by chance?
If so, you may want to try this instead...
Private Sub Text1_GotFocus(Index As Integer)
        Text1(index).text = Trim(Text1.Text)
        text1(index).selstart = 0
End Sub

You see, if the textbox is filled from a field which has 15 characters
it will be filled with whatever you see  *plus* any padding to 15.  
Bound controls are evil, better off writing your own code, at least
you have no surprises that way..

Regards, Frank



Fri, 16 Apr 2004 01:05:18 GMT  
 Newbie Needs Help on Textbox
Thanks for your help  Frank,
These TextBoxes are for APPEND.  They are blank to start with.
The TextBox are not bound.  Maxlength = 15.
I can only type 14 characters before the bell rings
and can not type anymore.  If I press the Delete Key,
THEN I can type the full 15 characters.

                            Magic



Quote:

>>of a field in the database.  But every time I type data in say,

>Ah... database.  Is/are your textboxes bound by chance?
>If so, you may want to try this instead...
>Private Sub Text1_GotFocus(Index As Integer)
>    Text1(index).text = Trim(Text1.Text)
>    text1(index).selstart = 0
>End Sub

>You see, if the textbox is filled from a field which has 15 characters
>it will be filled with whatever you see  *plus* any padding to 15.  
>Bound controls are evil, better off writing your own code, at least
>you have no surprises that way..

>Regards, Frank



Fri, 16 Apr 2004 23:19:52 GMT  
 Newbie Needs Help on Textbox

Magic,

Try what Chris and Jan said in the other thread, that's an easy one to
miss, curse of copy and paste. :)

Either way, assigning "" to it, in an InitText function should do the
trick.

Ie: Just before you start your edit session, call a function.:
Sub InitEdit()
        txtThis.Text = ""
        txtThat.Text = ""
End Sub.

I do something similar in any data entry page i have.

Quote:
>Thanks for your help  Frank,
>These TextBoxes are for APPEND.  They are blank to start with.
>The TextBox are not bound.  Maxlength = 15.
>I can only type 14 characters before the bell rings
>and can not type anymore.  If I press the Delete Key,
>THEN I can type the full 15 characters.

Regards, Frank


Sat, 17 Apr 2004 03:28:49 GMT  
 Newbie Needs Help on Textbox
Thanks for your help  Frank,
These TextBoxes are for APPEND.  They are blank to start with.
The TextBox are not bound.  Maxlength = 15.
I can only type 14 characters before the bell rings
and can not type anymore.  If I press the Delete Key before I type,
THEN I can type the full 15 characters.

                            Magic



Quote:

>>of a field in the database.  But every time I type data in say,

>Ah... database.  Is/are your textboxes bound by chance?
>If so, you may want to try this instead...
>Private Sub Text1_GotFocus(Index As Integer)
>    Text1(index).text = Trim(Text1.Text)
>    text1(index).selstart = 0
>End Sub

>You see, if the textbox is filled from a field which has 15 characters
>it will be filled with whatever you see  *plus* any padding to 15.  
>Bound controls are evil, better off writing your own code, at least
>you have no surprises that way..

>Regards, Frank



Sun, 18 Apr 2004 23:14:56 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Newbie needs help with TextBox

2. Newbie needs help with Loop to textBox

3. Need Report to look at SQL Data source ( VB / CR newbie needs help)

4. Help! Need help with TextBox Cntrl

5. Newbie Help ...Adding TextBoxes At RunTime

6. VB4 newbie help: Reading a real into a textbox

7. Newbie needing help badly!! Please help

8. HELP! Newbie needs help with SQL for VB3

9. Please Help Newbie Crystal Report / VB help needed.

10. HELP - Newbie needs help on simple problem!

11. Newbie needs help running help file

12. Help..Newbie needs help with collections...and arrays

 

 
Powered by phpBB® Forum Software