Results 1 to 3 of 3

Thread: TextBox UserControl Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    12

    Question TextBox UserControl Problem

    i am creating an UserControl in VB.net in which i have a textbox which contain properties like AllowOnlyNumeric,AllowOnlyCharacher etc so that i dont's have to code for these validations again n again plz give me some code to do that ASAP.

    I am doing something like this
    VB Code:
    1. Private Sub TextBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
    2.         If varOnlyNumber = True Then
    3.             'If Char.IsLetter(CChar(TextBox1.Text)) = True Then TextBox1.Text = ""
    4.             'If IsNumeric(e.KeyValue) Then e.KeyData.Clear()
    5.         End If
    6.  
    7.         If VarOnlyString = True Then
    8.             If Char.IsDigit(CChar(TextBox1.Text)) = True Then TextBox1.Text = ""
    9.         End If
    10.     End Sub
    Last edited by Hack; Sep 24th, 2005 at 05:26 PM.

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: TextBox UserControl Problem

    This might beling in the .NET forums.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: TextBox UserControl Problem

    Have you tried searching the VB.NET forum or CodeBank? There are several examples for a numbers only textbox, etc.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width