C# to VB

N

Nikolay Petrov

Can some please make this C# code to VB? Thanks.

[DllImport("msvcrt.dll", SetLastError=true)]

static extern int _mkdir(string path);


//this function should provide safe substitude for
Directory.CreateDirectory()

static DirectoryInfo CreateDirectory(string path)

{

int returnCode = _mkdir(path);

if (returnCode!=0)

{

throw new ApplicationException("Error calling [msvcrt.dll]:_wmkdir(" +
path + "), error code: " + returnCode.ToString());

}
return new DirectoryInfo(path);
}
 
C

Crouchie1998

Although that code is very easy to convert etc. If you done a search for C#
VB.NET you will have a few webpages that convert the code for you.

This isn't really a question for this group.
 
G

Guest

Our Instant VB C# to VB.NET converter produces:

<DllImport("msvcrt.dll", SetLastError:=True)> _
Shared Function _mkdir(ByVal path As String) As Integer
End Function
'this function should provide safe substitude for Directory.CreateDirectory()
Shared Function CreateDirectory(ByVal path As String) As DirectoryInfo
Dim returnCode As Integer = _mkdir(path)
If returnCode<>0 Then
Throw New ApplicationException("Error calling [msvcrt.dll]:_wmkdir("
& path & "), error code: " & returnCode.ToString())

End If
Return New DirectoryInfo(path)
End Function

David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter and the Instant VB C# to
VB.NET converter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top