1 Replies - 1520 Views - Last Post: 20 February 2009 - 05:14 PM Rate Topic: ***** 1 Votes

#1 0urangeapple  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 20-February 09

Shorter Code for removing letters and characters in a textbox

Posted 20 February 2009 - 05:00 PM

---

Is there any shortcut or shorter code for removing letters and special characters in a textbox?
I always use..
Private Sub text1_Change()
If Not IsNumeric(text1.Text) Then
text1 = ""
End If
End Sub

...and its pretty much tiring to change every single 'text1's into the different textnames.. especially when there's like 20 or more textboxes to be revised.

~

Is This A Good Question/Topic? 0
  • +

Replies To: Shorter Code for removing letters and characters in a textbox

#2 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Shorter Code for removing letters and characters in a textbox

Posted 20 February 2009 - 05:14 PM

Basically, your code does the job. Speaking about multiple controls, what about creating a control array and then loop through each text box control to apply your code?

You can find out more in this MSDN article:

http://msdn.microsof...18a(VS.80).aspx
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1