|
ActiveDirectory
Active Directory Code: GetGroups
Get the list of groups in a domain and return as an ArrayList.
Code: ListDomainNames
Gets a list of Domain names the user can see on the network.
HowTo: Logon Types
4 Ways to Logon using WinNT structures for ADSI (ActiveDirectory).
Code: getComputerProperties
Gets properties for the WinNT Computer in the specified domain
Code: getGroupMembers
Gets members in the WinNT AD group
Code: getGroupProperties
Gets properties for the WinNT AD Group
Code: getGroupTypeFlags
Get the Type of Group it is
Code: getLoginHours
Function for getting the loginHours for a given user and translating them to the actual login hours for the local time
Code: getUserFlags
Function for getting the UserFlags specified by the integer returned in the UserFlags Property
Code: getUserProperties
Gets properties for the WinNT AD user
Code: getUsers
Retrieves a list of users in the specified domain
Code: convertByteToSidString
Converts the Byte array to the SID string without the API
Code: convertSIDToStringAPI
API for "ConvertSidToStringSid"
Code: getGroupsUserIsMemberOf
Gets groups the WinNT AD user is a member of and returns the Primary
Group for the user ADO.NET
Example code, classes, routines and tips for working with ADO.NET.
General
General code and examples for working with ADO.NET
Snippet: Add a DataTable to a DataSet
Example of creating a DataTable and adding it to a DataSet object.
Snippet: Create a DataTable with Constraints, Keys, etc.
This example demonstrates how to create a DataTable with keys constraints, and defaults.
Snippet: Creating a DataTable
Example of creating a DataTable in code.
Code: DataSetFromXML
Populate a DataSet from an xml file.
Code: DataSetToXML
Save a DataSet to an XML file.
Code: DataSetToXMLString
Instantiate and save DataSet contents in xml format.
Code: IsDSPopulated
Test a DataSet to see if it contains data.
Snippet: RecordCount
Get the count of records/rows in a dataset table.
Code: CSVHelper
Code to read a CSV (comma separated value) file and return a Dataset.
OleDB
Code and examples for working with OLEDB datasources using ADO.NET
Code: GetDataReader
Create and return a DataReader given a valid connection and SQL statement.
Code: GetDataSet
Create and return a DataSet given a valid connection string and SQL statement.
Code: GetDataSetFromExcel
Returns a DataSet from the specified range in the specified Microsoft Excel worksheet.
Code: GetMultiDataSet
Create and return a multi-table DataSet given a valid connection string and an array of tables.
Code: GetScalarValue
Returns a single value given a connection string, table, and column name.
Code: OleDbDataToXML
Converts OLEDB data to XML format.
Code: GetFieldByName
Code to demonstrate how to access data in an OLEDBDataReader using a field name.
SQL Server
Code and techniques for working with SQL Server objects and data in ADO.NET.
Snippet: Connection-Based Transaction Example
Example of using a connection-based transaction to update data in two tables.
Code: GetDataReader
Create and return a DataReader given a valid connection and SQL statement.
Code: GetDataSet
Create and return a DataSet given a valid connection string and SQL statement.
Code: GetMultiDataSet
Create and return a multi-table DataSet given a valid connection string and an array of tables.
Code: GetScalarValue
Returns a single value given a connection string, table, and column name.
Snippet: Getting a Stored Procedure's Output Parameters
Example of capturing output parameters from a stored procedure.
Snippet: Getting a Stored Procedure's Return Value
Example of capturing the return value from a stored procedure.
Snippet: ReadBLOB
Read a BLOB of data from a column.
Snippet: ReadBLOBWithDS
Read a BLOB of data with a dataset object.
Snippet: ShowMultiDataSetRelated
Example of a multi-table DataSet with relations created between tables that are related in the source database.
HowTo: ShowNestedDataSet
This example illustrates how to create and navigate through nested recordsets.
Snippet: Simple Delete Example
This illustrates a simple way to execute a delete command against a SQL Server table.
Snippet: Simple Insert Example
This illustrates a simple way to execute an insert command against a SQL Server table.
Snippet: Simple Stored Procedure Example
Example of executing a stored procedure with no parameters.
Snippet: Simple Stored Procedure with Parameters
Simple example of getting data from a stored procedure using input parameters.
Snippet: Simple Update Example
This illustrates a simple way to execute an insert command against a SQL Server table.
Snippet: Sort and Filter a DataTable
Example of sorting a table in a DataSet by different columns.
Code: SqlDataToXML
Return SQL data as XML.
Snippet: Stored Procedure Update Example using Parameters
Example of using a stored procedure that updates data and requires input parameters.
Snippet: Table and Column Mappings Example
Example of using table and column mappings to customize the names of a DataSet's tables and columns.
Snippet: Update Data from a DataSet
Example of how to update a data source from a DataSet populated from it.
Snippet: Update Data with only a DataSet's Modified Data
Example code to Update Data with only a DataSet's Modified Data.
Snippet: Update from a DataSet using a Stored Procedure
Example code to Update from a DataSet using a Stored Procedure
Snippet: Update from a DataSet with Auto-Generated Commands
Example code to Update from a DataSet with Auto-Generated Commands
Snippet: WriteBLOB
WriteBLOB demonstrates how to write image data to a SQL Server table.
Snippet: WriteBLOBWithDS
WriteBLOBWithDS demonstrates how to write image data to a SQL Server table using a DataSet object.
Snippet: XML from a Stored Procedure to a File
Example of writing the XML returned from a stored procedure to a file. This example uses the GetProductXML proc in Northwind.
SQLDMO
Code for working with SQLDMO, the object model for SQL Server
Code: ListSQLServers
Get a list of available SQL Servers in the current domain.
Code: DynamicCrosstabQueries
SQL code for creating dynamic crosstab queries.
HowTo: GetImagePathIntoDatabase
Gets an image from a file, and updates the path in your SQL Server database, then loads the picture into the picturebox on a form.
Other: AuditCheck.SQL
SQL Script to generate Auditing functionality on a SQL Server table.
ADO Demos
Standalone procedures demonstrating ADO coding techniques
Code: ColumnComputeAndExpression
Demonstrate ADO computed columns and data column expressions
Code: CreateRunTimeTable
Demonstrate creating and using a datatable at run-time
Code: CreateRunTimeTableCloneCopyImportMerge
Demonstrate the ADO Clone, Copy, Import and Merge features
Code: DataTableFilterByRowState
Demonstrate filtering rows in a datatable by their state
Code: DataViewFind
Demonstrate finding a DataRowView in a DataView
Code: FillTableSelect
Demonstrate using a Data Adapter to fill a DataTable using a SQL Select statement
Code: FillTableSelectWithParameter
Demonstrate using a Data Adapter to fill a DataTable using a SQL Select statement that includes parameters
Code: FillTableWithProc
Demonstrate using a Data Adapter to fill a DataTable using a SQL stored procedure
Code: FillTableWithProcInputParams
Demonstrate using a Data Adapter to fill a DataTable using a SQL stored procedure with input parameters
Code: FilterWithDataView
Demonstrate using a DataView to filter rows from a DataTable
Code: GetDataAdapterSchemaInfo
Demonstrate using an ADO DataAdapter to retrieve schema information about a table
Code: GetDataReaderSchemaInfo
Demonstrate using an ADO DataReader to retrieve schema information about a table
Code: GetOleDBSchemaInfo
Demonstrate using an ADO connection to retrieve OLE schema information
Code: ProcCommandParameters
Demonstrate using stored procedures with parameters with a command object, and re-executing with new parameter values
Code: ProcFillMultipleTables
Demonstrate filling multiple DataTables in a dataset with the results of a call to a stored procedure
Code: ProcFillRelatedTables
Demonstrate filling a DataSet with multiple tables and creating relationships between them
Code: RelatedTablesExpressions
Demonstrate using expressions to refer to related data
Code: TableSelectRows
Demonstrate using a DataTable's Select method to select a subset of rows matching a condition
BusinessLayerSample
A class that....
Other: CreateBooksProcs.sql
T-SQL script to create stored procedures required by the BusinessLayerSample class
Other: CreateLibraryProcs.sql
T-SQL script to create stored procedures required by the BusinessLayerSample class
Other: CreateLibraryTables.sql
T-SQL script to create the tables and relationships required by the BusinessLayerSample class
Class: BusinessLayerSampleObject
Sample Business Layer class to show retrieval and update of data
Code: TestBusinessLayerSampleObject
Test procedure to demonstrate the use of the BusinessLayerSampleObject class
Data Utilities
Various data utilities for ADO.NET
Code: AddOutputParameter
Add an output parameter to the parameters collection
Code: AddOutputParameter
Add an output parameter to a parameters collection, specifying the parameter's type
Code: CreateParam
Create and return a parameter for a parameters collection
Code: SetDataTablePrimaryKey
Specify the primary key of a datatable
Code: SetDataTablePrimaryKey
Specify the primary key for a datatable, optionally specifying that the key is an autoincrementing type
Code: TimestampsDiffer
Code to determine whether two timestamps are different
Code: ValuesDiffer
Code to determine whether two objects are different
Databinding
Code: Form and control databinding example
This form demonstrates databinding to a datatable on a form as well as databinding for comboboxes
Collections
Article: Run-Time-Created DataTables
Tip: Use Run-Time-Created DataTables in place of collections.
AccessHelper
Code and examples for working with Access datasources using ADO.NET
Code: ExecuteDataset
Methods to execute OleDbCommands that return a resultset.
Code: ExecuteNonQuery
Methods to execute OleDbCommands that return no resultset.
Code: ExecuteReader
Methods to Create and prepare a OleDbCommand, and call ExecuteReader with the appropriate CommandBehavior.
Code: ExecuteScalar
Methods to execute a OleDbCommand against a specified database specified.
Code: Utility Methods and Constructors
Utility Methods and Constructors for working with Access datasources using ADO.NET.
Monitor Access or Jet Connections
Code and examples for listing connections on Access or Jet databases
Class: JetWatcher
Class to list connections to an Access/Jet database
Code: JetWatcher Example Form
Example form that shows how to use the JetWatcher class
ParameterQueryBuilder
Code and example for building parameterized ADO.NET queries.
Code: ParameterQueryBuilder
Assists building parameterized ADO.NET queries.
HowTo: ParameterQueryBuilder Example
Example for the ParameterQueryBuilder class.
QueryReader
Code and examples for filling an ADO.NET dataset in batches, and pausing a long-running query.
Code: Example Form for QueryReader
Example form for using the QueryReader class to fill an ADO.NET dataset in batches, and pause a long-running query.
Class: QueryReader Class
Code for filling an ADO.NET dataset in batches, and pausing a long-running query.
ADO Interface Code and Example
Code and example that creates and consumes a generic IDbConnection and IDataAdapter object.
Class: ADO Interface Class
Shows a generic business layer method that creates and consumes a generic IDbConnection and IDataAdapter object.
Item: ADO Interface Sample Form
Example form for the ADO Interface class.
TableBuilder
Code and example for building a DataTable from scratch. Add columns, specify primary keys, set default values, and more.
Code: Example Form for TableBuilder
Example form for using the TableBuilder class to create a DataTable from scratch.
Class: TableBuilder Class
Code for creating a DataTable from scratch. Add columns, specify primary keys, set default values, and more. ASP.NET
Code, examples, and information for working with Active Server Pages.NET.
General
General techniques in ASP.NET.
HowTo: Change Page Background Color
Change an HTML page's background color
HowTo: GridLayout vs. FlowLayout
HowTo: Scrollable Controls
Snippet: Simple Browser Capabilities Utility
Use basic ASP.NET code to get browser capabilities
HowTo: Upload Files Larger than 4mb
Module: Data Binding
How to access controls in DataList Header & Footer
Module: Upload and Download by Streaming
This code sample demonstrates how to upload and download files in ASP.NET by streaming.
Authentication
Code, examples, and techniques for working with Authentication in ASP.NET.
HowTo: Authentication for Different Pages/Directories
Authentication for Different Pages/Directories
HowTo: Configuring Forms Authentication
HowTo: Configuring Passport Authentication
HowTo: Configuring Windows Authentication
How to configure Windows Authentication
Snippet: How to Reference the Authenticated Users Name
How to Reference the Authenticated User's Name
Code: LoginFormsAuth
This method contains the basic steps required to authenticate a user using Forms authentication.
Code: LogoutFormsAuth
Basic code necessary to log the current user out of the application when using Forms authentication.
Code: WindowsAccountDetails
Saves the properties of the current user authenticated with windows authentication to a collection.
Client-Side Behavior
Code, examples, and notes for working with web browsers using client-side code.
HowTo: Add Client-Side Script to a Page from ASP.NET
HowTo: Adding Client Script to a Form
Snippet: Disable Context Menu in the Browser
Use the context menu event to disable the right-click menu.
Snippet: Open a Page from a Popup Window
Javascript code to open a page.
HowTo: Prompt User before Button Submits a PostBack
Snippet: Show a Message Box from a Button
Use the Javascript Alert function.
Snippet: Using DHTML Effects with Web Server Controls
Configuration
Techniques for configuring ASP.NET applications.
HowTo: Always Show the ASP.NET Error Page
HowTo: Configuring ASP.NET Tracing
How to set up ASP.NET Tracing
HowTo: Handling Errors with Custom Redirects
HowTo: Handling Errors with Default Redirects
HowTo: Smart Navigation
Information about the ASP.NET SmartNavigation feature to control adding pages to the browser's cache.
Managing State
Code, examples, and notes for managing state in ASP.Net applications.
Code: Cookieless Sessions
HowTo: Overview of Session State Configuration
Code: ShowCachedItems
Iterate and display all items in the ASP.NET application's cache.
Security
Code and notes for working with ASP.NET security
Article: ASP.NET Security Overview
Server Controls - Basics
HowTo: Adding Events to Controls
HowTo: Applying Styles
Snippet: Creating a Password-Masked TextBox
Code: Iterate Through Web Form Controls
Use the controls collection to iterate all controls on a web form.
Server Controls - Data Binding
Repeated-Value Controls
Article: Data-Binding Expressions
DataGrid
HowTo: Use AlternatingItemStyle on a DataGrid
Define a data grid style that uses different background colors for every other row.
Example of Binding, Paging, and Sorting
This example demonstrates how to bind to multiple data sources using a single web form and DataGrid, and how to implement paging and sorting in the grid.
WebForm: DataGridBind.aspx
Class: DataGridBind.aspx.vb
Example of Editing Data
WebForm: DataGridEditBound.aspx
Class: DataGridEditBound.aspx.vb
Example of Filtering Data
Shows how to filter data on a datagrid control.
WebForm: DataGridFilter.aspx
Class: DataGridFilter.aspx (Code behind)
Example of Finding Data
Shows how to find data on a datagrid control.
WebForm: DataGridFind.aspx
Class: Code behind for DataGridFind.aspx
DataList
HowTo: Use AlternatingItemStyle on a data list control
Define a data list style that uses different background colors for every other row.
Example of Binding a DataList to a DataTable
Class: Code behind for DataListDataTable.aspx
WebForm: DataListDataTable.aspx
Example of Binding a DataList to a HashTable
How to bind a datalist object to a hashtable object.
Class: Code behind for DataListKeyValue.aspx
WebForm: DataListKeyValue.aspx
Example of Binding a DataList to Arrays
How to bind a datalist object to an array object.
Class: Code behind for DataListArray.aspx
WebForm: DataListArray.aspx
DropDownList
HowTo: Firing the SelectedIndexChanged Event
Example of Binding a DropDownList
How to bind data to a dropdownlist control.
Class: Code behind for ControlsDemo.aspx
WebForm: ControlsDemo.aspx
Single-Value Controls
HowTo: Binding to a Function
HowTo: Binding to Another Control
Caching
Articles, How-To's, and code for how to use caching to create high-performance Web applications.
Application Data Caching
Code, How-To's, and Articles for using Application Data Caching.
Article: Add
Adding items to the cache with the Add and Insert methods.
Article: Cache Item Removed Event
Using the Cache Item Removed Event.
Article: Delete
Using the Remove method to delete items from cache.
Article: Retrieve
Binding a grid to data from cache.
Output Caching
Code, How-To's, and Articles for using Output Data Caching.
Article: Fragment Caching
Fragment Caching to store a version of the control in the output cache.
Article: Page Caching
Setting an expiration for the cached output of a dynamically generated page.
Module: Webservice with Caching
This module demonstrates how an ASP.NET Webservice can be cached for performance.
Validation Web Server Controls
Examples for using ASP.NET's Validation Web Server controls.
WebForm: Compare Validator Control
This example shows how to use the Compare Validator Control.
WebForm: Custom Validator Control
This example shows how to use the Custom Validator Control.
WebForm: Range Validator Control
This example shows how to use the Range Validator Control.
WebForm: Regular Expression Validator Control
This example shows how to use the Regular Expression Validator Control.
WebForm: Required Field Validator Control
This example shows how to use the Required Field Validator Control.
WebForm: Validation Summary Control
This example shows how to use the Validation Summary Control.
Mobile Web Development
Code for Mobile Web Development
WebForm: Simple Mobile Web Page
Simple Mobile Web Page Using mobile:Link, mobile:Label, mobile:PhoneCall and mobile:ObjectList Controls
Delete Confirmation Code and Examples
Code and example for prompting users to confirm delete operations in ASP.NET.
HowTo: Delete Confirmation
Code for prompting users to confirm delete operations in ASP.NET.
Delete Confirmation Example
Example for prompting users to confirm delete operations in ASP.NET.
Item: WebForm1.aspx Code
Example for prompting users to confirm delete operations in ASP.NET.
Item: WebHelper Code
Example for prompting users to confirm delete operations in ASP.NET.
ASP.NET ModalDialog
Shows how to create a Modal Dialog, and return values to the parent page.
Class: ASP.NET ModalDialog Base Page
SubClass Page class to support ModalDialog window
Class: Code Behind WebForm1.aspx
Code behind the Popup Window (WebForm1.aspx)
Class: Code Behind WebForm2.aspx
Code behind the WebForm that opens the Popup Window (WebForm2.aspx)
WebForm: WebForm1.aspx
Popup Window
WebForm: WebForm2.aspx
Web Form to open Popup Window
User Controls
WebTreeControl
Server-Side tree control
Module: AssemblyInfo
TestWebTreeControl
Simple WebForm to demonstrate the usage of WebTreeControl.
Class: Code behind for Global.asax
Class: Code Behind for Index.aspx
WebForm: Index.aspx
XML: Microsoft Games.xml
Sample data file
Class: WebTreeControl
Web Control (Visible to Designer)
Class: WebTreeNode
Represents a single node in the tree control.
IE WebControls
Code, Tips, and Tricks for using IE Web Controls.
Article: How to Install Internet Explorer Web Controls
How to Install Internet Explorer Web Controls
WebForm: MultiPage WebControl Example
MultiPage WebControl Example
WebForm: TabStrip WebControl Example
TabStrip WebControl Example
HowTo: Repair IIS Mappings to ASP.NET
Steps to repair IIS mappings to ASP.NET.
DataGrid Customization
ASP.NET DataGrid Customization
Code: Highlight and Select Row with JavaScript
ASP.NET DataGrid Customization: Highlight and Select Row with Client-side JavaScript
Data Structures
Enumerations
Enumerations
Code: Text File to Enumeration
Code to open a text file and read it into an enumeration.
General .NET Programming
General .NET Programming Techniques
Keyboard
Code for working with the Keyboard in .NET.
Code: EatKeystrokes
Prevent a control from seeing specific keystrokes
Windows 32 Keyboard
Work with keyboard attributes through WMI.
Code: GetKeyboardInfo
Gets Keyboard properties
Code: GetKeyboardDeviceID
Gets the DeviceID for the Keyboard. Needed for all other Keyboard information.
Processes
Code for working with Processes
Code: RunProgram
Run an external program.
Code: ShowRunningProcesses
Show all processes running on this machine.
Code: ShowRunningUIProcesses
Show all processes running on this machine that have created UI (i.e. have windows)
Code: WaitForProcess
Wait for a process to finish
Code: TimeoutWaitForProcess
Wait for a process for a specified period of time.
Code: CountOfApplicationInstances
Return a count of the running instances of the current application.
Class: FormWindowsTimerManyTimers
This form contains example code that illustrates how efficient Windows.Forms.Timer objects are.
Code: IsAppRunning
Check to see if another instance of the current application is already running.
Code: BatchFileResults
Launch an external command and get the results.
Miscellaneous
Miscellaneous items for general .NET programming.
HowTo: Build an Evaluate Function
How to create a replacement for the VB Eval() function
Class: ClearConsole
Code to clear the console in a Console application
HowTo: Detect if Code is Running from the IDE
Detect if Code is Running from the IDE
Code: GetWinVer
Return a string with information about the current Windows Version
Article: Calling Objects with Optional Parameters from C#
Tip: How to call a COM or VB.NET method with optional parameters from C#.
Article: Overloading on Overloads
Overloading on Overloads
Article: TypeCastingInVB
Type Casting in Visual Basic .NET
Data Structures
Arrays
Snippet: ArrayList as a Substitute for an Array
Snippet: Iterating through an Array
Snippet: Join and Split Strings Example
Code: ReadOnlyArray
Snippet: Searching an Array
Collections
Code: ArrayToStringCollection
Class: GenericCollection
Snippet: SimpleCollection
Code: StringCollectionToArray
Article: Debugging Collections
Debugging Collections in Your Visual Studio .NET Applications
Files, Disks and Folders
Code for working with Windows Files, Disk, and Folders
General
Code: CopyFiles
Copies all files from the specified source directory to the specified destination directory.
Snippet: ListEnvironmentVars
Enumerate Environment Variables using a HashTable
Code: EraseDirectory
Deletes all items in a directory, including sub dirs and sub dir files and the deletes the directory itself.
Code: GetLocalDrives
Use the System.Management classes to invoke WMI to get a list of local drives.
Code: GetNetworkAdapters
Use the System.Management classes to invoke WMI to get a list of network adaptors.
Code: GetWindowsVersionInfoFromDotNet
Returns information about the Windows OS version using the .Net libraries.
Code: PrintDirectoryTree
Recursively prints a list of directories to the console.
Code: RecursiveCopyFiles
Recursively copy all files and subdirectories from the specified source to the specified destination.
Code: RecursiveSearchForFiles
Search for files matching the specified pattern in the specified directory and all its children.
Snippet: Using System.IO.Path
Examples showing how to use the System.IO.Path library to work with paths.
Code: WriteFile
Use a FileStream to write a new file.
Code: WriteToTempFile
Writes the specified text to a temp file and returns the temp file path and name
Class: UNCDrives
A class to show a how to get the UNC mapping from a drive letter.
Code: ChangeFileNameFromReadOnly
Remove the readonly attribute from the specified file.
Code: ReturnFileNameAsDate
Generate a new file name based on the current date and time.
Code: ReadFile
Open the specified file and return its contents as a string.
Class: GetWindowsVersionInfoFromAPI
Code: GetRunningProcesses
Use the System.Management classes to invoke WMI to get a list of running processes.
Code: ListComputersOnNetwork
Returns a list of all computers on the network and places the results in a listview.
Directory and File Info
Directory and File operations
Code: AppendToFile
Append Text to a file
Code: CreateDir
Creates a directory and returns DirectoryInfo Structure for it.
Code: CreateFile
Create a file
Code: DeleteDir
Deletes a directory with options to delete subdirectories and files recursively.
Code: DeleteFile
Delete a file
Code: DirExists
Check for existence of a directory
Code: FileExists
Check for the existence of a file
Code: GetCurrentAppDir
Gets the directory the application is open from
Code: GetDirectoryAttributes
Returns the attributes of any given directory as a string
Code: GetDirsInPattern
Get a list of directories matching a specific search pattern.
Code: GetDirsInPatternRecursive
Recursively get a list of directories and subdirectories matching a specified pattern.
Code: GetFileAttributes
Get the attributes of a file.
Code: MoveDir
Moves a directory from one location to another.
Code: MoveFile
Move an existing file to another location
Code: OpenFileForWrite
Create a file and write to it.
Code: OpenFileWithParameters
Open a File by specifying specific parameters.
Code: PopulateDirectories
Populates a TreeView Control with the directories of the drive you specify. This is a Recursive function.
Code: CompareFiles
Compare to files, byte by byte
Code: EnsureNoTrailingSlash
Code to ensure that there is no backslash between the end of the path and the file name.
Code: EnsureTrailingSlash
Code to ensure that there is a backslash between the end of the path and the file name.
Logical Disk
Logical Disk information using the WMI Management structure
Code: GetDeviceID
Code: GetDriveType
Gets the DriveType using System.Management and Win32_LogicalDisk
Code: GetFileSystem
Code: GetMaximumComponentLength
Code: GetMediaType
Code: GetName
Code: GetQuotasDisabled
Code: GetQuotasIncomplete
Code: GetQuotasRebuilding
Code: GetSize
Code: GetSupportsDiskQuotas
Code: ChkDsk
Code: GetAllDrivePropertiesAvailable
Code: GetCaption
Code: GetCompressed
Code: GetDescription
Code: GetSupportsFileBasedCompression
Code: GetSystemName
Code: GetVolumeDirty
Code: GetVolumeName
Code: GetVolumeSerialNumber
FlatFileBuilder
Utility collection class to assist in creating fixed-column width flat text files.
Code: FlatFileBuilder
Contains the FlatFileBuilder collection class and the FlatFileColumn Class.
Snippet: FlatFileBuilder Demo
Demo for the FlatFileBuilder class.
HTTP and FTP
Code for working with HTTP and FTP protocols.
Code: DNSResolveLocalHost
Code: GetIPAddress
Code: LaunchURL
Code: LaunchURLWithChecks
Code: MakeHTTPGetRequest
Code: ResolveHost
Code: WebBrowserToDefaultPage
Mail
Snippet: Send Email
Code: ComposeMail
Launch the default email client to send mail.
Math
Code: GenRandom
Code: GenRandomBounded
Code: IsCloseTo
Fuzzy Match
MathAreaVolume
This category contains mathematical functions for determining the area and volume of various objects.
Code: AreaOfCircle
Returns the area of a circle
Code: AreaOfRectangle
Returns the area of a rectangle
Code: AreaOfRing
Returns the area of a ring
Code: AreaOfSphere
Returns the area of a sphere
Code: AreaOfSquare
Returns the area of a square given the length of one side
Code: AreaOfSquareDiag
Returns the area of a square given the length of the diagonal
Code: AreaOfTrapezoid
Returns the area of a trapezoid
Code: AreaOfTriangle
Returns the area of a triangle
Code: AreaOfTriangle2
Returns the area of a triangle
Code: LenOfRectangleDiagonal
Returns the length of the diagonal of a rectangle
Code: LenOfSquareDiagonal
Returns the length of the diagonal of a square
Code: VolOfCone
Returns the volume of a cone
Code: VolOfCylinder
Returns the volume of a cylinder
Code: VolOfPipe
Returns the volume of a pipe
Code: VolOfPyramid
Returns the volume of a pyramid or cone
Code: VolOfSphere
Returns the volume of a sphere
Code: VolOfTruncPyramid
Returns the volume of a truncated pyramid
MathGeneral
This category contains general math routines, such as rounding, factorials, and determining the minimum and maximum values from a set of numbers.
Code: ComputeWindChillEnglish
Calculate the wind chill for exposed human skin
Code: ComputeWindChillMetric
Calculate the wind chill for exposed human skin
Code: GetGCF
Returns the greatest common factor (largest number that evenly divides into two numbers)
Code: GetRandomInt
Returns a random integer value between the range specified in the arguments, inclusive
Code: IsNumberPrime
Determines if a number is a prime number
Code: MaxOfThree
Returns the greatest of three values (null values are ignored)
Code: MinOfThree
Returns the smallest of three values (null values are ignored)
Code: PrimeFactors
This procedure calculates the prime factors of a number
Code: ScalePercent
Scales a value to a range between 0 and 100 (number could be less than 0 or greater than 100 if the 'current' value is less than 0 or greater than the 'max' value)
Code: Subtract
Subtract two numbers with decimals correctly
Code: RoundDown (corrected)
Rounds the passed number to specified number of decimal places with 0.5 rounded down
Code: RoundUp (corrected)
Rounds a number to a specified number of decimal places (0.5 is rounded up)
MathStatistics
Mathematical functions covering the areas of statistics and probability
Code: CoefficientOfVar
Returns the coefficient of variance
Code: Factorial
Returns the factorial of a given number
Code: FactorialRecursive
Returns the recursive factorial of a given number
Code: GetArrayMean
Returns the mean (average) of the elements in the supplied array
Code: GetArrayMedian
Returns the median of the elements in the supplied array
Code: GetArrayMode
Returns the mode (most common value) of the supplied array. If there is a tie, the smallest number is the mode.
Code: GetNumberCombinations
Returns the number of combinations of items that can be derived from a population (order does not matter)
Code: GetNumberPermutations
Returns the number of combinations of Items that can occur from Pool (order matters)
Code: StdDev
Returns the standard deviation of the array
Code: StdError
Returns the standard error
Code: SumElements
Returns the sum of array elements
Code: SumOfSquaredElements
Returns the sum of the square of array elements
Code: VarianceOfArray
Returns the variance of the array
MathTrigonometry
Code that covers derived math functions for trigonometry, including cosines, tangents and secants.
Code: ArcCoSecant
Returns the inverse cosecant of the supplied number
Code: ArcCotangent
Returns the inverse cotangent of the supplied number
Code: ArcSecant
Returns the inverse secant of the supplied number
Code: CoSecant
Returns the CoSecant of the supplied number. Note that sin(num) cannot equal zero. This can happen if num is a multiple of cdblPI.
Code: CoTangent
Returns the Cotangent of the supplied number. Function is undefined if input value is a multiple of PI.
Code: HyperbolicArcCosecant
Returns the Inverse Hyperbolic Cosecant of the supplied number
Code: HyperbolicArcCosine
Returns the Inverse Hyperbolic Cosine of the supplied number.
Code: HyperbolicArcCotangent
Returns the Inverse Hyperbolic Tangent of the supplied number. Undefined if num is 1.
Code: HyperbolicArcSecant
Returns the Inverse Hyperbolic Secant of the supplied number
Code: HyperbolicArcSine
Returns the Inverse Hyperbolic Sine of the supplied number
Code: HyperbolicArctan
Returns the Inverse Hyperbolic Tangent of the supplied number. The return value is undefined if input value is 1.
Code: HyperbolicCosecant
Returns the Hyperbolic Cosecant of the supplied number.
Code: HyperbolicCotangent
Returns the Hyperbolic CoTangent of the supplied number
Code: HyperbolicSecant
Returns the Hyperbolic Secant of the supplied number.
Code: Secant
Returns the secant of the supplied number
Unit Conversions
Functions for performing unit conversions
Class: Unit Conversions
Functions for performing unit conversions
Item: BMI Calculator
Code and example for calculating BMI (Body Mass Index)
Diagnostics
Shows examples of using the System.Diagnostics namespace
EventLogs
Code: ClearLogEntries
Clears all log entries from the specified log
Code: DeleteLog
Deletes the specified log
Code: NewEventLog
Creates a new log and an entry, and optionally clears or deletes it
Code: WriteLogEntry
Writes an entry to an existing log
Processes
Provides access to local and remote processes and enables you to start and stop local system processes
Code: GetBasePriorities
Returns a hash table containing the name and base priority for each process currently running
Code: GetProcessInfo
Returns a hash table containing information about the current process
Code: StartProcess
Starts the specified process
Code: StartProcessWithParameters
Starts the specified process with parameters
Web EventLog (I)
Web application to show view EventLog
Class: Code behind for EventLogConsole.aspx
Class: EventEntry
WebForm: EventLogConsole.aspx
XML: Web.Config
Web EventLog (II)
Web application to show view EventLog
Class: Code behind for Default.aspx
WebForm: Default.aspx
Class: EventLogHelper
XML: Web.Config
Web Performance Monitor
Web application to show current performance counters' reading
Class: Code behind for PerfMonConsole.aspx
Class: Global.asax
Class: PerfCounter
WebForm: PerfMonConsole.aspx
XML: Web.Config
Registry
Code for reading from and writing to the registry
Code: CreateKeyAndSubKey
Creates a new key and subkey under the specified HKEY node
Code: DeleteKeyValue
Deletes a value from the specified subkey
Code: DeleteSubKey
Deletes a subkey and all of its subkeys
Code: DeleteSubKeyWithNoSubItems
Deletes a subkey only if it has no subkeys
Code: GetKeyValues
Returns a hashtable containing all value names and values for the specified subkey
Code: GetSubkeyCount
Returns a count of subkeys for the specified key
Code: GetSubKeyNames
Returns an array of the subkeys in the specified key
Code: GetValueCount
Returns a count of values in a subkey
Code: SetKeyValue
Sets the default value for the specified subkey
Strings
Code: ArrayToString
Converts the passed array to a delimited string
Module: CharacterType
Illustrates how to determine what type of character is in the specified location
Code: CleanAmpersand
Doubles every ampersand character in the input string to replace the hot key with an ampersand character
Code: CleanQuotes
Coverts double-quote (") characters in a string to apostrophes (')
Code: ContainsAlpha
Determines if there are alpha characters other than "-" in the supplied string
Code: CountDelimitedWords
Returns the number of words in a delimited string
Code: CountOccurrences
Returns the number of times a string appears in a string
Code: CountWords
Returns the number of words separated by spaces
Code: EncloseString
Wraps the string in the specified characters
Code: FillString
Generates a string of repeated characters
Code: GenRandomPassword
Generates a random string suitable for a password
Code: GetDelimitedWord
Returns a word from a delimited string
Code: InsertString
Inserts one string into another at the specified location.
Code: LowerCase
Converts the passed string to lower case
Code: NumberSuffix
Converts an integer into a string with a trailing suffix
Code: PadLeftString
Left-pads a string to intStrLength characters for right justification
Code: PadRightString
PadRightString
Code: ProperCase
Converts the passed string to proper case
Code: StringToArrayOfWords
Converts a delimited string to an array of words
Code: UpperCase
Converts the passed string to upper case
Code: ValidateUSZip
Formats the supplied US zip code
Code: EncodeAsBase64
Encodes the input string as Base64 and returns it as a byte array
Code: DecodeFromBase64
Decodes the passed base64 byte array back into a string
Code: TextToHTML
Encode text in an HTML safe manner by delimiting special characters.
Snippet: A String as an Array of Characters
Code: Concat
Snippet: Copy a String
Snippet: Copy Part of a String
Code: FindCharacterInString
Code: FindCharactersInString
Code: GenGUID
Code: InsertString
Snippet: Match the End of a String
Snippet: Match the Start of a String
Code: Remove
Snippet: Remove and Replace a String
Code: Replace
Snippet: String Formatting Examples
Snippet: Substring Example
Snippet: Test Equality of Two Strings
Code: GenRandomPassword
Generates a random string suitable for a password
Article: String Addition in .NET
This article discusses when and how to use the StringBuilder class, and when it's not worth the trouble.
Date and Time
modDateTime
|