How to load notepad value in textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vaniKanabathy
    New Member
    • Mar 2008
    • 52

    How to load notepad value in textbox

    I need to call back what i had write in notepad using vb application. I can do it using the coding below but the problem is i want to retrive the value in different textbox but all the values in notepad appear in 1 textbox.Like in notepad i got values like

    f
    g

    In textbox the values appear like Text1 = fg
    Text2 = fg

    Actually i want like Text1 = f
    Text2 = g


    Coding:

    Public Sub LoadTextBox(Not epadFile$, XTextBox As TextBox)

    On Error GoTo a:

    Dim chk As String
    Dim hld As String

    If Dir(NotepadFile $, vbNormal) = "" Then
    MsgBox "File Not Found: " & NotepadFile$
    Exit Sub
    End If

    Open NotepadFile$ For Input As #1
    Do Until EOF(1)
    Line Input #1, chk
    hld = hld & chk & vbNewLine
    Loop
    Close #1

    hld = Left(hld, Len(hld) - 2)
    XTextBox.Text = hld

    a:

    End Sub
    Private Sub Form_Load()

    FName$ = "D:\Output. txt"
    LoadTextBox FName$, Text1
    LoadTextBox FName$, Text2

    End Sub
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    try these steps

    1.read from text file.
    2.extract one char from the text.
    3.display 1 char in each text box.

    Comment

    Working...