Help in searching a record in a text file VB 2008 RRS feed

  • Question

  • Okay, I am in the last part of my project. IT is a registration program. For searching, the user will insert his UserIdno first, then his personal details (record) in the text file will be shown in the form. I am quite stuck at this coding. Can you explain if you suggest a coding because I am quite new in VB 2008.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

            MaskedTextBox1.Text = UserIdno

            If UserIdno = "" Then

                MsgBox("Please insert the your User ID")

                For Each UserIdno As String In MaskedTextBox1.Text

                    FileOpen(1, "C:\UserDetails.txt", OpenMode.Append, OpenMode.Output)

                    If My.Computer.FileSystem.FileExists(UserIdno) Then


    *********( the part where I don't know the coding)*********

                    End If
            End If

        End Sub

    Tuesday, August 18, 2009 4:44 AM


  • You're at *Small Basic* forum here, not *Visual Basic .NET* one :-)

    You should have a look at the IO.FileStream / IO.StreamReader API, though.
    A more complex but better solution would the serialisation of a List(Of ...) into a file.
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Marked as answer by FremyCompany [MSFT] Tuesday, August 18, 2009 6:25 PM
    • Unmarked as answer by purple0212 Wednesday, August 19, 2009 1:20 AM
    • Proposed as answer by 4000a Wednesday, August 26, 2009 4:50 PM
    • Marked as answer by FremyCompany [MSFT] Wednesday, August 26, 2009 6:20 PM
    Tuesday, August 18, 2009 6:25 PM