Technology Microsoft Software & solutions

How to Check if a Textbox Input Is Numeric in Visual Basic

    • 1). Launch Microsoft Visual Basic Express and click "New Project" on the left pane of your computer screen. Click "Visual Basic" below "Installed Templates," click "Windows Forms Application" and click "OK" to start a new project.

    • 2). Double-click the "TextBox" control on the "Toolbox" pane to add one to your form. Add a "Button" using the same technique.

    • 3). Double-click the button to create a button click event, and add the following code to create two variables:

      Dim numericCheck As Boolean

      Dim inputTxt As String

    • 4). Type the following code to get the value entered in the textbox and check if it's numeric using the "IsNumeric" function:

      inputTxt = Me.TextBox1.Text

      numericCheck = IsNumeric(inputTxt)

    • 5). Add the following code using the Boolean variable and let the user know if the value was numeric:

      If numericCheck Then

      MsgBox("You entered a numeric value.")

      Else

      MsgBox("You did not enter a numeric value.")

      End If

    • 6). Press "F5" to run the code and click "Button1."

Related posts "Technology : Microsoft Software & solutions"

How to Import OCX

Microsoft

How to Install Grub From a Fedora Recovery CD

Microsoft

How to Speed Up Streaming in Vista

Microsoft

How to Fix a Disappearing "Start" Menu, "Start" Button and Task Bar

Microsoft

How Do I Modify Startup in Vista?

Microsoft

How to Change Your Name in CP

Microsoft

How to Use WinImage to Create a Boot Disk ISO

Microsoft

How to Get to a BIOS Screen

Microsoft

How to Control Updates on XP

Microsoft

Leave a Comment