Results 1 to 3 of 3

Thread: [RESOLVED] how to match with value in text file

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    5

    Resolved [RESOLVED] how to match with value in text file

    i have data in two text box, then i want to match it with data in text file. after match, i want to take value in column 3.

    textbox1= 2.9167 will refer to column 1
    textbox2 = 101.7745 will refer to column 2

    example data in text file:
    column1 column 2 column 3

    2.9100 101.7705;60
    2.9103 101.7767;40
    2.9110 101.7756;20
    2.9167 101.7744;60
    2.9167 101.7745;60
    2.9167 101.7746;50
    2.9167 101.7747;80

    after match value in text box with value in text file, i need value in column 3(e.g 60, in red color). how to write the code?can anyone help me...

    thanks..

  2. #2
    Fanatic Member amrita's Avatar
    Join Date
    Jan 2007
    Location
    Orissa,India
    Posts
    888

    Smile Re: how to match with value in text file

    Try this code!

    Code:
        Open "F:\1.txt" For Input As #1
            While (Not EOF(1))
                Line Input #1, strLine
                strArr = Split(strLine, ";")
                strTextValue = Split(strArr(0), " ")
                If Trim(strTextValue(0)) = Trim(Text1.Text) And Trim(strTextValue(1)) = Trim(Text2.Text) Then
                   Text3.Text = strArr(1) '--3rd column value
                End If
                
            Wend
       Close #1

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    5

    Re: how to match with value in text file

    thanks amrita

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