.NET Environmental Related...

What are .NET Assemblies, GACs, Manifests, Config Files, Version Policies?
Learn all about .NET Assemblies, the Global Assembly Cache (GAC), Manifests, Config Files, Version Policies, etc.

Add/Remove Shared Assemblies to/from the GAC.
Use "GacUtil" to add a shared assembly to, or remove it from, the Global Assembly Cache (GAC).

Get a WinForm application's path in VB.NET or C#.
Get the path to a WinForm application in VB.NET or C# using the "System.Reflection" namespace and the "Application" object.

Retrieve your .NET app's Assembly Info data.
Retrieve a .NET Application's "Assembly Info" data such as version, company name, title, etc, using the "System.Reflection" namespace.

Retrieve your .NET app's Configuration Settings data.
Retrieve a .NET Application's Configuration Settings (appSettings) data, stored in the App or Web config file, using the "System Configuration" namespace.

Read your .NET app's Common Language Runtime/Framework Version.
CLR info is stored in the application's XML based configuration (.Config) file which you can read by walking its XML DOM.

Edit .NET 2003 solutions with earlier versions of .NET.
Edit a .NET 2003 solution with an earlier version of .NET by changing its "Solution" and "Project" files.

Get your PC's Network Interface Card's MAC Address or Hard Drive Serial Number in VB.NET.
Use Windows Management Instrumentation (WMI) and the .NET System.Management namespace's ManagementObjectSearcher to programmatically get your PC's Network Interface Card's MAC Address or Hard Drive Serial Number.

General .NET Programming Related...

Prevent multiple instances of a Windows Form application.
Create "singleton" applications to prevent multiple instances of your WinForm program using the "GetCurrentProcess" method in the "System Diagnostics" namespace.

Display Window's Page Setup Dialog using the PageSetupDialog object.
Display Window's standard "Page Setup Dialog" using the "PageSetupDialog" object. The PageSetupDialog object lets you set features like paper orientation, printer selection, etc.

Use AddHandler/Delegates to add/remove event handlers dynamically.
.NET lets you add and remove "Event Handlers" dynamically. You can start and stop handling events at any time during program execution. VB.NET provides the "AddHandler" and "RemoveHandler" commands. In C# you do this with "delegates".

Define your own Event Arguments when using Delegates.
Define and pass your own "Event Arguments", derived from the "System.EventArgs" namespace, when using "Delegates".

Localize Web Pages Using .NET.
Localize Web Forms Pages so their text appears in the language the end user utilizing to view your application. Resource Files are used to hold the text to display.

Using .NET ArrayLists and Hashtables.
"ArrayLists" are similar to arrays but with the ability to grow. "HashTables" or "dictionaries", let you store any type of object in key/value pairs.

Using .NET NameValueCollections.
"NameValueCollections" are a specialized type of collection in .NET that are similar "HashTables" or "dictionaries" but which let you store multiple string values for a single key.

Enumerate through the values of an ENUM in VB.NET
Programmatically enumerate or loop through the values of an ENUM in VB.NET.

How and why to Serialize objects in VB.NET.
In .NET you can Serialize objects, store them in a file, retrieve them and use them as if they were in memory the whole time.

Launch and monitor external programs from .NET.
Launch and monitor external programs from .NET. Similar to VB's Shell command and the "WaitForSingleItem" API but with the "Process" class in NET's System Diagnostics namespace.

Use multi-threading in .NET applications.
Use multi-threading in .NET applications to spawn worker threads to keep your app responsive.

Late Bind COM Component with VB.NET.
In VB6 you used "CreateObject" to late bind to a COM Components. In VB.NET you use "Activator CreateInstance".

Create a Windows Service using .NET.
Create a Windows Service using .NET. Services are processes that run unattended and don't have a user interface. Windows Services can start when the operating system boots and other applications can interact with them.

Dynamically type in, compile, and execute VB.NET source code!
Read in uncompiled VB.NET source code from a file at runtime, compile it, and then execute it.

.NET Debugging and Error Handling Related...

Debug runtime code via the Trace class with EventLog and TraceLog listeners.
"Debug" and "Trace" in the .NET Framework's "System.Diagnostics" namespace help you find bugs at design and run time. Debug lets you display a variable's content and debug messages at design time. Trace traces application information at run time.

Get the name of the currently executing method.
.NET's "StackFrame, "StackTrace" and "MethodBase" clases from the "System.Diagnostic" and "System.Reflection" namespaces allow you to dynamically retrieve the name and characteristics of the currently executing method in your application.

How to handle unhandled exceptions in VB.NET.
In VB.NET you can catch all unhandled exceptions, when no Try-Catch block is used, using the Application Domain object where your application executes.

.NET Security Related...

Get the current user's name and domain.
Get the name and domain of the currently logged in user via the "System Security" namespace and the "Windows Principal" object.

See if a user belongs to a local or global security group.
Use the "IsInRole" function of a "WindowsPrincipal" object to determine if a user belongs to a specific local or global security group.

Programmatically Use Impersonation in ASP.NET.
Learn about IIS and ASP.NET security, the user accounts and groups used during anonymous access, and how impersonation works. See how to impersonate another user's security credentials via the web.config and programmatically though your VB.NET code.

.NET WinForm and Control Related...

Derive or subclass a DataGrid or other control in VS.NET.
With .NET you can derive a new control from an existing control and your new control inherits all the features and functionality of the original. You can then subclass your control by adding new properties and methods and override existing methods to alter their behavior.

Add a derived control's icon to the VS.NET Toolbox.
Once you derive a new control you can add its icon to the VS.NET Toolbox.

Change a label's forecolor on mouseovers in VB.NET or C# by swapping the font in the "MouseEnter" and "MouseLeave" events.
Change a label's forecolor on mouseovers.

Create an Irregular shaped Windows Form.
Create an "Irregular", non-rectangular shaped Windows Form using any bitmap image. The bitmap is scanned, a Windows Region is created, then applied to the form.

Move a Windows Form that has no title bar.
Move a Windows Form that has no title bar by creating a new "point" in the "MouseDown" event, determining the current loacation in the "MouseMove" event and moving the form to that location.

Add ProgressBars to .NET StatusBars.
Add a ProgressBar to a .NET StatusBar control by subclassing the StatusBar.

Change the Color of Individual ListBox items.
Change the color of individual ListBox items in .NET by writting your own handler for the listbox's "DrawItem" event. This creates an "Owner Drawn" listbox.

Populate Treeview controls from an XML file.
Populate a Treeview control from an XML file by recursively walking the XML DOM and adding the XML nodes to the treeview control.

.NET I/O and File Related...

Create, read, write and delete event logs.
Create, read, write and delete event logs in VB.NET with the "EventLog" class in the System Diagnostics namespace.

Detect when a file or folder changes using the FileSystemWatcher.
Detect when a file or folder changes using VB.NET's "FileSystemWatcher" class from the "System.IO" namespace.

Get Windows Special Folder Paths in .NET.
Special Folders are Windows folders such as: My Documents, Desktop, Favorites, Recent, Documents and Settings, Cookies,.... Here's how to get the path to these folders.

Read Text files with .NET.
Read an ASCII Text file with .NET use the "StreamReader" class in the "System.IO" namespace.

List all files in a folder and get their attributes in VB.NET.
List all files in a folder and get their attributes in VB.NET using the DirectoryInfo class of the System.IO namespace.

Invoke NTFS file compression from C#.
Invoke NTFS file compression from C# using the "DeviceIoControl" function imported from the Kernel32 DLL.

ZIP files from .NET applications.
Create ZIP files from .NET applications by referencing the Java Runtime and using the functionality in the java.util and java.util.zip namespaces.

Browse for folders using Shell32.dll in C#.
Browse for folders using the Shell32 DLL's "BrowseForFolder" function in C#.

Convert comma delimited data to XML via XSLT.
Convert comma delimited data to XML using "Extensible Stylesheet Language Transformations (XSLT)".

.NET String and Regular Expression Related...

Validate data with Regular Expressions.
Regular expressions provide a flexible and efficient way to process text. Their extensive pattern-matching notation lets you to quickly parse large amounts of text to find specific character patterns and to extract, edit, replace, or delete text substrings.

Find unique words in documents using Regular Expressions.
Regular Expressions have extensive pattern-matching notation that can be used extract substrings matching certain patterns.

Use MeasureString to measure a string's height and width.
"Graphics.MeasureString", exposed by the "PaintEventArgs" parameter of the "Paint" event, measures a string when drawn with a specified font and returns a structure containing its height and width in pixels.

Convert Strings to Byte Arrays and Back.
Convert Strings to Byte Arrays and Back in .NET with the "System.Text.Encoder" namespace.

Determine if a string value is numeric in C#.
Check if a string value is numeric in C#, similar to VB's "IsNumeric" function.

.NET Excel Related...

Paste data into Excel worksheet's with the Excel object.
Using the Excel object, via the COM Interop Layer, you can work with Excel worksheets, ranges, cells, etc. from .NET.

Prevent orphaned Excel processes after using the Excel object.
Prevent an orphaned Excel process after using the Excel object by instructing COM to release the components. You must use the "System Runtime InteropServices Marshal ReleaseComObject" function.

.NET E-mail Related...

Send Email with attachments from VB.NET applications.
Send Email, with attachments, from VB.NET applications using the "System Web Mail" namespace.

Send Email using the ShellExecute API equivalent.
Send Email using the "System Diagnostics Process Start" command, the equivalent of the "ShellExecute" API.

Send Email using the MailTo command.
Send Email from HTML using the "MailTo" hyperlink command. When an email hyperlink is clicked, the user's default email client will create a new email with the To, Subject,... fields pre-populated.

ASP.NET Related...

AJAX in ASP.NET 2.0
Make asynchronous, out of band, client callbacks from your ASP.NET 2.0 application.

AJAX (Asynchronous JavaScript and XML) Tutorial
Make asynchronous, out of band, client callbacks from any version of your ASP.NET application to update portions of web pages without rendering the complete web page.

Upload files from client PCs to a web server with ASP.NET
Upload files from a local, client PC to the web server with ASP.NET using the "System Web UI HtmlControls" namespace's "HtmlInputFile" server control.

Change the cursor to a Wait cursor in ASP.NET
Change the cursor to a wiat or hourglass cursor on your ASP.NET web page.

Conditionally set properties of web pages controls with the Databinder in ASP.NET
The Databinder class of the System.Web.UI namespace lets you dynamically create bindings between any property on an ASP.NET page, including server control properties, and a data source.

Embed client side JavaScript in ASP.NET 1.1 pages.
Embed client side JavaScript in ASP.NET 1.1 web pages from your code behind with the "RegisterStartupScript" and "RegisterClientScriptBlock" commands.

Embed client side JavaScript in ASP.NET 2.0 pages.
Embed client side JavaScript in ASP.NET 2.0 web pages from your code behind with the "RegisterStartupScript" and "RegisterClientScriptBlock" commands.

Determine if ASP.NET's Session Object has timed out.
ASP.NET lets you pass user specific data between web pages using the "Session object" but uses a timeout feature to discard a session information. See how to detect if the session has timed out.

Format data in a bound DataGrid on an ASP.NET web page.
The ASP.NET DataGrid's BoundColumn control lets the data displayed be formatted via the DataFormatString property.

Programmatically loop through an ASP.NET Datagrid to retrieve cell values.
See how to loop through an ASP.NET Datagrid with both server side code and with client side JavaScript to retrieve cell values when the cells contain plain text or controls such as textboxes and checkboxes.

Set focus to a specific control on an ASP.NET web page.
With a little JavaScript you can set the focus to a particular control on your ASP.NET web page.

Use the HTTP Cache in ASP.NET web pages to improve performance.
ASP.NET lets you cache static data in the web server's memory dramatically improving web page performance instead of reading it from a file or database each time it is needed.

Understanding and working with cookies in ASP.NET.
Learn about the idiosyncrasies of the Request and Response Cookie objects in ASP.NET and how to correctly use cookies avoiding the common errors.

Issue a modal JavaScript dialog from ASP.NET server code.
See how to conditionally issue a modal JavaScript Alert dialog from your ASP.NET page's codebehind.

Save a DataSet to Excel in ASP.NET and allow the user to open or save it.
In ASP.NET, you can create a DataSet, export it to a file as XML, then allow the user to open or save the file from their browser.

ADO.NET DataSet/DataTable Related...

See if the contents of an ADO.NET DataSet changed.
Determine if the contents of an ADO.NET DataSet have changed.

Set default values for new rows in a DataSet/DataTable.
Set default values for new rows in a DataSet/DataTable.

Print a DataSet with the PrintDocument object.
Print a DataSet's contents in VB.NET using the PrintDocument object.

Retrieve schema info from Excel worksheets.
Retrieve schema information from an Excel worksheet.

Bind a DataTable to a Combobox in VB.NET.
Bind a DataTable to a Combobox in a VB.NET program.

Add DataRows to a Combobox without data binding.
Add DataRows to a Combobox in VB.NET without data binding.

Add new DataColumns to a .NET DataTable.
Add new DataColumns to a .NET DataTable.

.NET WinForms DataGrid Related...

Make the DataGrid support single select mode.
Make the DataGrid support single select mode vs. the default multi-select mode.

Get the DataSet row after a bound DataGrid was sorted.
Get the corresponding DataSet row after the bound DataGrid was sorted and rows added.

Programmatically scroll a DataGrid to a given row.
Programmatically scroll the WinForms DataGrid to a particular row.

Confirm DataGrid deletes when the DEL key is hit.
Display a Delete Confirmation dialog when the DEL key is pressed.

Stop Deletes when the DEL key is hit in a DataGrid.
Stop Deletes from occurring when the DEL key is pressed in a DataGrid.

Disable TAB, Arrow, Home, End, and Page keys in a .NET DataGrid.
Disable the TAB, Arrow, Home, End, and Page keys in the .NET DataGrid.

Prevent column resizing in a .NET DataGrid.
Prevent columns from being resized in the .NET DataGrid.

Programmatically move columns in the .NET DataGrid.
Programmatically move columns in the .NET DataGrid.

Format columns in .NET Winforms DataGrid.
Format columns in a .NET Winforms DataGrid.

Hide columns in .NET Winforms DataGrids.
Hide a column in a .NET Winforms DataGrid.

Winforms DataGrid with no current cell.
Make the Winforms DataGrid have no current cell.

Get the clicked row or column in a DataGrid.
Get the row or column that was clicked on in the DataGrid.

Programmatically end DataGrid cell editing.
Programmatically end the editing of a cell in the DataGrid.

Add databound ComboBoxes to DataGrids.
Add databound ComboBoxes to the DataGrid in C# or VB.NET.

Limit keyboard input to DataGrid cells.
Use events to limit keyboard input to DataGrid cells.

Make DataGrid row read only based on a cell's value.
Make a DataGrid row read only when it is clicked based on a cell's value.

Sum DataGrid columns to produce totals.
Sum up a column in the DataGrid to produce a total.

Filter datagrid rows as the user types.
Filter datagrid rows as the user types the first few letters of a column's value.

Crystal Report Related...

Create a Crystal Report from an XML schema.
Create a Crystal Report based on an XML schema file.

Create a Crystal Report using a .NET DLL as the DataSource.
Create a Crystal Report using a .NET DLL as the DataSource.

Use the CrystalReportViewer control.
Run a Crystal Report using the CrystalReportViewer control.

Pass parameters into a Crystal Report.
Pass parameter values into a Crystal Report for .NET.








About TheScarms
About TheScarms


Sample code
version info

If you use this code, please mention "www.TheScarms.com"

Email this page



The World's Number 1 Web Host

© Copyright 2014 TheScarms
Goto top of page