|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
C# to VB[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); } 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); > } > > > 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); > } > > > > "Nikolay Petrov" <johntup2_nospam_@mail.bg> schrieb: Converting code between .NET programming languages> Can some please make this C# code to VB? Thanks. <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/>
FileSystemObject vs System.IO.File
compression of a string , but must be interoptable someone an idea ?? Array of Hash Tables Query database in VB.NET Create ListView columns dynamically from XML record locking with DBF (visual basic) table in ADO OLEDB in VB.NET Set Desktop Progress Bar Setup problem How to have embeded pictures in a project |
|||||||||||||||||||||||