Results 1 to 3 of 3

Thread: types of data in variables?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    types of data in variables?

    the user of my program is going to enter something to search for into a text box.

    and depending on which option box they choose it either needs to be text or numeric data and I need to error code to prevent accidentally searching for a numeric field for a text string and so on..

    i know in c++ theres a function like istext or something like this.. is there any way I can pass a check to find out what type of data the variable contains?

    I appreciate any help in advance.. heres my code.

    Dim strFind As String
    strFind = txtFind.Text

    If optRoute.Value = True Then
    Adodc1.RecordSource = "SELECT * FROM DistTable WHERE RteNum = " & strFind
    Adodc1.Refresh
    txtFind.Text = ""
    txtFind.SetFocus
    Exit Sub
    End If

    If optLast.Value = True Then
    Adodc1.RecordSource = "SELECT * FROM DistTable WHERE LName = '" & strFind & "'"
    Adodc1.Refresh
    txtFind.Text = ""
    txtFind.SetFocus
    Exit Sub
    End If

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    If IsNumeric(text.text) then
    'it is a number
    Else
    'A string
    End If
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    tanks

    thanks again.. much appreciated

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