Results 1 to 3 of 3

Thread: Please help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Location
    florida
    Posts
    18
    I know it should be easy,but I am new to vb.
    I have to read a text file and validate it.
    there is an information that starts ona sertain position and is 70 characters long.It comes in a format like this.
    for example:lastname *firstname*mi* i have to validate it so when it finds the first asterisk its the end of the last name and so on.if there is first or middle missing add another*
    Thank you

  2. #2
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    I'm not 100% sure what you are saying, but why not have seperate text boxes for the fields and then for the command button you put:

    Code:
    If txtFirstName.text = "Dimava" then
    MsgBox "Name Validated"
    Else
    MsgBox "Incorrect Name"
    End if
    NXSupport - Your one-stop source for computer help

  3. #3
    Junior Member
    Join Date
    Sep 2000
    Location
    Poland
    Posts
    26
    hi, kruks,

    I think U need InStr instruction. It lets U find one string in another one.

    Example:

    dim s as string
    dim sFirst as string
    dim sLast as String
    dim iAge as integer
    dim iPos as integer

    s="first_name*last_name*age"

    'I look for first name
    iPos = InStr(1,s,"*")
    sFirst = left(s, iPos-1)
    s = right(s,len(s)-iPos)

    'I look for last name
    iPos = InStr(1,s,"*")
    sLast = left(s, iPos-1)
    s = right(s,len(s)-iPos)

    'I look for the age
    iAge=Val(s)

    Hope it'll help

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