Home All Groups Group Topic Archive Search About
Author
28 Mar 2005 1:33 PM
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);
}

Author
28 Mar 2005 2:03 PM
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.


Show quoteHide quote
"Nikolay Petrov" <johntup2_nospam_@mail.bg> wrote in message
news:%23Brnwq5MFHA.2704@TK2MSFTNGP15.phx.gbl...
> 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);
> }
>
>
>
Author
28 Mar 2005 4:03 PM
David Anton
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

Show quoteHide quote
"Nikolay Petrov" wrote:

> 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);
> }
>
>
>
>
Author
28 Mar 2005 7:03 PM
Herfried K. Wagner [MVP]
"Nikolay Petrov" <johntup2_nospam_@mail.bg> schrieb:
> Can some please make this C# code to VB? Thanks.

Converting code between .NET programming languages
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=languageconverters&lang=en>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>