Encryption/Decription using the windows CryptoAPI
This class provides encryption/decryption through the CryptoAPI. This is the standard API you can use regardless of the underlying dll used to do the encryption. These dlls are called Cryptographic Service Providers (CSPs) and you get one as standard from Microsoft called "Microsoft Base Cryptographic Provider v1.0" This class uses the standard CSP, but this can be changed by changing the constant SERVICE_PROVIDER There is additional code in this class to ensure that the encrypted values do not contain CR or LF characters so that the result can be written to a file A word of warning: If you are going to use WritePrivateProfileString to write the encrypted value to an ini file, you must write a NULL first to delete the existing entry as it does not clear previous entries when writing binary data. This is a problem if you are overwriting a value with a smaller one.
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Upload
Upload
<font face="Verdana" size="2">
<div align="center"><b>Extending The Browse For Folder Dialog Class For VB.NET</b></div>
<p>This code is simpily extending the Browse For Folder Dialog class that was on posted on PSC by Chris Andersen. After using his code, I was interested in knowing if there was any additional options available aside from just being able to set the title. I consulted the MSDN, and posted it under the C# section of PSC. Here is VB.NET version of that code. The above screen shot is showing the Browse For Folder dialog with StartLocation set to "MyDocuments" and Style set to "BrowseForEverything"</p>
<p><b>.StartLocation</b><br>
<hr width="100%" size="1" color="#000000">
The directory in which the browse dialog will start at. (duh) I haven't found a way to specifiy a certain path, like C:\PSC or something of that nature, but there are a number of members that we can use. They are:
<ul>
<li>Desktop</li>
<li>Favorites</li>
<li>MyComputer</li>
<li>MyDocuments</li>
<li>MyPictures</li>
<li>NetAndDialUpConnections</li>
<li>NetworkNeighborhood</li>
<li>Printers</li>
<li>Recent</li>
<li>SendTo</li>
<li>StartMenu</li>
<li>Templates</li>
</ul>
<p><b>.Style</b><br>
<hr width="100%" size="1" color="#000000">
They style of the browse dialog. We have a few different options to choose from.
<ul>
<li>BrowseForComputer</li>
<li>BrowseForEverything</li>
<li>BrowseForPrinter</li>
<li>RestrictToDomain</li>
<li>RestrictToFilesystem</li>
<li>RestrictToSubfolders</li>
<li>ShowTextBox</li>
</ul>
</p>
<p><b>The Code</b><br>
<hr width="100%" size="1" color="#000000">
Here's an example of how to use the above methods in the Browse For Folder dialog.
<pre><font size="2">
Public Class BrowseForFolder
Inherits System.Windows.Forms.Design.FolderNameEditor
Dim bDialog As New FolderBrowser()
Public Function BrowseDialog(ByVal sTitle As String)
With bDialog
.Style = FolderBrowserStyles.BrowseForEverything
.StartLocation = FolderBrowserFolder.Desktop
.Description = sTitle
.ShowDialog()
BrowseDialog = .DirectoryPath()
End With
End Function
End Class
</font></pre>
</p>
<p><b>Useage:</b><br>
<hr width="100%" size="1" color="#000000">
Call the class like so:
<pre><font size="2">
Dim myDialog As New BrowseForFolder()
MsgBox(myDialog.BrowseDialog("My Dialog Title Here"))
</pre>
<b>Make sure you add a reference to the System.Windows.Forms.dll in your Solution Explorer!</b>
It's pretty simple. Thanks again to Chris Anderson for the or