Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

Relative path

$
0
0
Hi all,

im working on a DB that wotes to a file and would like to have the text file within the VB.net app. I currenlty write to the file as below...... but would like not to have a hard wired location if you know what i mean ;). Thanks in advance

Public Class frmNewUser

Private Sub Send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Send.Click


Dim strFile As String = "e:\test.txt"
Dim sw As StreamWriter
Try
If (Not File.Exists(strFile)) Then
sw = File.CreateText(strFile)

Else
sw = File.AppendText(strFile)
End If

sw.WriteLine(txtusername.Text & vbTab & txtpassword.Text )

sw.Close()
MsgBox("User account created - login succ")

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>