0

I have a folder inside there will be my program.
and a .ini file in other folder.

Example

New Folder/My .EXE HERE
New Folder/Lol1/Lol2/Test.ini

How i make the program to get the current directory?

i have this

Dim sPath As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        sPath = "\Lol1\Lol2\Test.ini"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Button1.Enabled = True Then
            INIWrite(sPath, "title ini", "my text in ini", TextBox1.Text)
        End If
    End Sub

But doesn't edit it only if i use "C:\ and all the path"
but what about if i want to publish and make other to download my file they wont be able to use the same path because is in my pc only ...

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by xfrolox
0

Got it working.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Button1.Enabled = True Then
            INIWrite(App_Path() & "Test.ini", "title ini", "my text in ini", TextBox1.Text)
        End If
    End Sub

    Public Function App_Path() As String
        Return System.AppDomain.CurrentDomain.BaseDirectory()
    End Function

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.