Help with my code please!! need it for tommorrow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • redAllison21
    New Member
    • Mar 2008
    • 2

    #1

    Help with my code please!! need it for tommorrow

    Dim fileToCopy, NewCopy, txtFiles, inpFiles As String
    Dim sr As New StringReader(Te xtBox3.Text)

    fileToCopy = ("c:\" + inpFiles + ".txt")
    NewCopy = ("C:\jj.txt" )

    sr = New System.IO.Strin gReader(TextBox 3.Text)
    inpFiles = sr.ReadLine()
    Do
    txtFiles += inpFiles & CrLf
    inpFiles = sr.ReadLine()
    MsgBox(inpFiles )

    If System.IO.File. Exists(fileToCo py) = True Then
    System.IO.File. Copy(fileToCopy , NewCopy)
    MsgBox("We are Done You Have Won")
    End If


    Loop Until inpFiles = Nothing
    sr.Close()

    for some reason the stringreader will not read the line of input from the textbox.

    what have i done Wrong????


    thanks
  • jg007
    Contributor
    • Mar 2008
    • 283

    #2
    Originally posted by redAllison21
    Dim fileToCopy, NewCopy, txtFiles, inpFiles As String
    Dim sr As New StringReader(Te xtBox3.Text)

    fileToCopy = ("c:\" + inpFiles + ".txt")
    NewCopy = ("C:\jj.txt" )

    sr = New System.IO.Strin gReader(TextBox 3.Text)
    inpFiles = sr.ReadLine()
    Do
    txtFiles += inpFiles & CrLf
    inpFiles = sr.ReadLine()
    MsgBox(inpFiles )

    If System.IO.File. Exists(fileToCo py) = True Then
    System.IO.File. Copy(fileToCopy , NewCopy)
    MsgBox("We are Done You Have Won")
    End If


    Loop Until inpFiles = Nothing
    sr.Close()

    for some reason the stringreader will not read the line of input from the textbox.

    what have i done Wrong????


    thanks
    I am fairly new to VB coding but i'm not sure if you are using stringreader correctly as does not look quite right, what do you expect this code to do?

    also at least when I read it as you have posted it you are using inpfiles before assigning it any text when you use "fileToCopy = ("c:\" + inpFiles + ".txt")"

    Comment

    Working...