Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

May i ask how can i save my test.txt to the location i want to save.

$
0
0

i would like save my test.txt,  to the location i setting i don't want setting on local disk c or d,  i want save the test.txt on my currentpath folder. can some one pls help me take a look.

   

this is my strCurrPath location.

strCurrPath = (Application.StartupPath)
strCurrPath = Replace(Application.StartupPath, "\bin\Debug", "")

Public Sub ProceedSave()
        Dim strdatenow As String
        Dim strtime As String
        Dim UserName As String

        UserName = pw.Text

        strCurrPath = (Application.StartupPath)
        strCurrPath = Replace(Application.StartupPath, "\bin\Debug", "")

        Try
            Dim file As System.IO.StreamWriter
            strdatenow = Format(Now, "dd-MM-yyyy")
            strtime = Format(Now, "HH-mm")
            file = My.Computer.FileSystem.OpenTextFileWriter("d:\test.txt", True)
            file.WriteLine(strdatenow + "::" + strtime + "::" + UserName)
            file.Close()
        Catch ex As Exception

        End Try
    End Sub


Viewing all articles
Browse latest Browse all 2535

Trending Articles