Hi Woody,
Two days ago someone did ask something, that did look strange in all the
answer that have been given here, but when we did something (not one person
but more persons) in this newsgroup it did work and it is quiet normal that
it does work.
I thought with that I can do in future something.
Now you are asking for something I thought that I could, so I did make it.
Try it, I thought that it does what you ask
I hope this was what you where looking for?
Cor
\\\
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim txtboxarea As TextBox() = New TextBox() {TextBox1, TextBox2}
'In the array are all the textboxes you want to trim that you made in design
time
For Each txt As TextBox In txtboxarea
AddHandler txt.LostFocus, AddressOf TextBox_LostFoc us
Next
End Sub
Private Sub TextBox_LostFoc us(ByVal sender As Object, _
ByVal e As System.EventArg s)
DirectCast(send er, TextBox).Text = _
Trim(DirectCast (sender, TextBox).Text)
End Sub
///
It is hard for me to imagine a time when you would not want to have the
data in a textbox control trimmed. I am hoping there is some sort of switch
that can be set for all text boxes so that when the user leaves the text box it
gets trimmed. Is there such a thing. If not, does this mean I need to
write some sort of trimming code for each text box I place on a Winform.
If so, what is the simplest and easiest way for me to see to it that all text
boxes get trimmed?