Settings Help

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
15 posts Page 2 of 2
Contributors
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Re: Settings Help
Agust1337
Hello Usman55,
I have created some test app here, please tell me if it's what you want.
You do not have the required permissions to view the files attached to this post.
Top-notch casual Dating
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Settings Help
Usman55
I tried it but the same problem occurs. It creates a folder named Log.txt instead of a txt file.
Image
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Re: Settings Help
Agust1337
Hello Usman55,
Alright I didn't understand you at first but now I do, here we go:
Code: Select all
 Dim mLog As String = "c:\log.txt"
    'Please +rep if it helped! 
    'Thanks, Agust1337 @ CodenStuff.
    Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
        'this is not neccicary needed, but I prefer using this piece of code.
        Dim dir_name As String = txtFile.Text
        If System.IO.Directory.Exists(dir_name) Then
            lbl1.Text = "This path : " & dir_name & " exists"
            btnNew.Visible = False
        Else
            lbl1.Text = "Sorry your path: " & dir_name & " does not exist"
            btnNew.Visible = True
        End If
    End Sub

    Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
        'I am just using Try if any problems are with the code so you wont recieve an framework error.
        Try
            Dim fs As FileStream = Nothing
            If (Not File.Exists(mLog)) Then
                fs = File.Create(mLog)
                Using fs

                End Using
            End If
            MsgBox("Your path " & txtFile.Text & " has successfully been created!", MsgBoxStyle.Information)
        Catch ex As Exception
            MsgBox("Your path " & txtFile.Text & " could not be created.", MsgBoxStyle.Critical)
        End Try
    End Sub

    Private Sub txtFile_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFile.TextChanged
        'I use this just to make the app abit more professional
        If txtFile.Text = "" Then
            btnCheck.Enabled = False
            btnNew.Enabled = False
        Else
            btnCheck.Enabled = True
            btnNew.Enabled = True
        End If
    End Sub
Top-notch casual Dating
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

Re: Settings Help
Usman55
I'll try it later!
Image
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Re: Settings Help
Agust1337
Okay, please tell me if there is something else.
Top-notch casual Dating
15 posts Page 2 of 2
Return to “Coding Help & Support”