I'have this litle piece of code which worked nice under windows XP and Windows Vista but won't do a thing under Windows7.

I use it to store link adresses to apllications I wish to hoock up to.
Basicly I first select a apllication with a "Open File Dialog" and then create a folder on a specified location wherin I create a txt.file to which I write the adress.
So far so good.
But Windows7 just doesn't let me create a folder !!!!!

Does anyone have any sugestions?
Help will be realy appreciated.

Imports System
Imports System.IO
Imports System.Text
Public Class Adressen
    Private Sub Adressen_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
    Public Sub kots()
        Dim kots As String
        kots = databaseadres()
        If kots = " " Then
            Exit Sub
            TextBox1.Text = kots
        End If
    End Sub
    Private Sub maak_adres()

        Dim pad, databaseadres As String
        pad = "C:\Users\All Users\TDhulp"
        databaseadres = "C:\Users\All Users\TDhulp\databaseadres.txt"

        If Not Directory.Exists(pad) Then
        End If

        If Not File.Exists(databaseadres) Then
        ElseIf File.Exists(databaseadres) = True Then
            Exit Sub
        End If

    End Sub
    Private Sub BtnAdress_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnAdress.Click

        Dim FILE_NAME As String = "C:\Users\All Users\TDhulp\databaseadres.txt"   '"C:\Users\Floris\Documents\visuele troep\test.txt"
        Dim objWriter As System.IO.StreamWriter
        Dim fname As String

        With OpenFileDialog1
            .InitialDirectory = objapprenticeServerApp.FileLocations.Workspace
            .Title = "Select  File"
            .DefaultExt = ".iam"
            .Filter = "Inventor Part File  (*.iam) | *.iam"
        End With

        Dim Filename As String
        fname = OpenFileDialog1.FileName
            objWriter = New System.IO.StreamWriter(FILE_NAME)
        Catch ex As Exception
        End Try

    End Sub

Edited 5 Years Ago by Eekhoorn: n/a

Try running your program as Administrator. It should be one of the security features that is stopping you.
You could try working in the documents folder, in order to avoid having to run it as Administrator.

This article has been dead for over six months. Start a new discussion instead.