Instead you need to actually use a p/invoke api call. Here is the code:Imports System.TextImports System.Runtime.InteropServices <DllImport("kernel32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Public Shared Function GetShortPathName(ByVal lpszLongPath As String, _ ByVal lpszShortPath As StringBuilder, ByVal cchBuffer As Integer) As Integer End Function Private Function ConvertLongPathToShort(ByVal longPathName As String) As String Dim shortNameBuffer = New StringBuilder Dim size … Continue reading Converting Long Path Names To Short Path Names
Category: VB.NET
Microsoft Releases the Visual Basic .NET Power Pack
The Power Pack controls consist of: BlendPanel. This provides a background for a form where the color fades from one shade to another. UtilityToolbar. This is a toolbar whose look and feel is similar to the Internet Explorer toolbar. ImageButton. This is a button that displays a graphic over a transparent background. NotificationWindow. This displays … Continue reading Microsoft Releases the Visual Basic .NET Power Pack
Visual Basic @ The Movies
Convert a Bitmap to a Byte Array
Dim stream As MemoryStream = New MemoryStream Dim bitmapBytes As Byte() 'Create bitmap Dim bitmap As Bitmap = New Bitmap(50, 50) bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg) bitmapBytes = stream.ToArray stream.Close() bitmap.Dispose() Tip Submitted By: David McCarter
The Visual Basic .NET Resource Kit
Sending E-Mail With The Users Default Program
Just use the code below. I'm sure you will want to replace the hard-coded values with parameters from a method.Dim mailProcess As New Process()Dim processInfo As New System.Diagnostics.ProcessStartInfo() processInfo.FileName = "mailto:someone@someone.com?" _ & "cc=someoneelse@someone.com&" _ & "subject=Sample Subject&" _ & "body=Body of Message" processInfo.UseShellExecute = True processInfo.WindowStyle = ProcessWindowStyle.Normal mailProcess.StartInfo = processInfo mailProcess.Start(processInfo) Tip Submitted By: David McCarter This … Continue reading Sending E-Mail With The Users Default Program
Retrieving Decimal Places From A Number (Without Rounding)
It’s was told to me that this can never be shown to the client and further more the number can never be rounded (anyone ever see Office Space… sound familiar?). So I went searching on how to do this in .NET. After many, many hours of searching and testing, I could not find any way … Continue reading Retrieving Decimal Places From A Number (Without Rounding)
Get the Application Path
The function below returns the appliction path for an appliction in the Compact Framework. Shared Function GetAppPath() As StringDim mstrPath As StringmstrPath = _ System.IO.Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly().GetModules (0).FullyQualifiedName)If Right(mstrPath, 1) <> "\" ThenmstrPath += "\"End IfReturn mstrPathEnd Function Tip Submitted By: David McCarter & Marquis Howard
How to Safely Get WebForm Control Value
So I created the nifty little Function below: Private Function GetWebFormValue(ByRef WebForm As System.Collections.Specialized.NameValueCollection, _ ByVal ControlName As String) As String Try Return WebForm(ControlName).ToString Catch Return String.Empty End TryEnd Function Here is how to use it: pstrTemp = GetWebFormValue(Request.Form, "txtZipCode") If you have an easier, better way to do this same thing, please let me … Continue reading How to Safely Get WebForm Control Value
Common SQLConnection Methods in VB.NET
Below are some converted VB6 methods that do common database connection tasked. The first one (CheckSQLConnection) checks to make sure that a connection can be made to the database. This could be used at the beginning of your application or web application to make sure that the database is up. If it's not, doubt if … Continue reading Common SQLConnection Methods in VB.NET

You must be logged in to post a comment.