Hi there,
Just wondering if its possible to get a textbox to post-back at each character being entered into the textbox, rather than having to wait until the user tabs out of the textbox to have the textchanged event occur.
The reason being, i have a credit card text field, with which i want to have a space placed after every 4-digits are entered into the textbox.
Ie, after a user types in "1234", the textbox text would change to "1234 " etc. Therefore, a full credit card string may be something like "1234 5678 1234 5678". The code that i have at the moment is as follows:
Private Sub tbCCNumber_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbCCNumber.TextChanged
If Not me.IsInitializing then
cc_counter = cc_counter + 1
cc_stringtotal = cc_stringtotal + 1
Dim currccstring as string
if (cc_counter = 4) and (cc_stringtotal <> 19) then
currccstring = tbCCNumber.Text
tbCCNumber.Text = currccstring & " "
cc_counter = 0
end if
end if
end sub
Thanks for reading this, and i hope that you may be able to help me with this very soon.
Regards,
Michelle
Just wondering if its possible to get a textbox to post-back at each character being entered into the textbox, rather than having to wait until the user tabs out of the textbox to have the textchanged event occur.
The reason being, i have a credit card text field, with which i want to have a space placed after every 4-digits are entered into the textbox.
Ie, after a user types in "1234", the textbox text would change to "1234 " etc. Therefore, a full credit card string may be something like "1234 5678 1234 5678". The code that i have at the moment is as follows:
Private Sub tbCCNumber_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbCCNumber.TextChanged
If Not me.IsInitializing then
cc_counter = cc_counter + 1
cc_stringtotal = cc_stringtotal + 1
Dim currccstring as string
if (cc_counter = 4) and (cc_stringtotal <> 19) then
currccstring = tbCCNumber.Text
tbCCNumber.Text = currccstring & " "
cc_counter = 0
end if
end if
end sub
Thanks for reading this, and i hope that you may be able to help me with this very soon.
Regards,
Michelle