All Visual Basic Extension Methods
-
TabStop
Place a tab stop into a string
-
GetParentProcessID
The method extends the Process class to retrieve (if possible) the id of the parent process. The method uses P/Invoke to access the system data. It uses API in kenrnel32.dll (CreateToolhelp32Snapshot, Process32First, Process32Next).
-
SaveToFile
This Extension Method saves string content to a file
-
CopyToEntityList
Copy DataTable rows to IEnumerable(Of T)
-
IsEmail
Extend string with boolean test for a valid email address
-
LoadFromFile
Read and assign a file content to String Variable
-
ToDictionary
Converts Dictionary to DataTable and DataTable to Dictionary
-
Indent
Indents strings with a variable number of characters/strings
-
Print
DataGridView.Print("TITLE")
-
LastValue
Returns the the last row value for a column
-
ToDbl
Handling null values for obejct
-
Speak
Spreak the text using a SpeechSynthesizer
-
IsEmail
Check string for valid Email address
-
FirstOrNothing
Returns the first element of a sequence, or a nullable value which has no value if no element is found.
-
FirstCharToUpper
Converts the first char of a string to an upper case letter.
-
IsNothingOrEmpty
Return if a datatable is nothing or if is empty.
-
ToDelimitedString
Converts a List(Of String) into a delimited string.
-
In
Is Object in list
-
ToDatatable
Creates a DataTable representation of a Dictionary
-
ConnectionStringEx
Several extensions to assist with setting a connection string for an OleDb.Connection to an Excel file for Excel 97-2003 or Excel 2007 and above.
-
Self
Provides Self method for all classes. This is useful inside a With block (when you don't want to declare a variable which references the object you are working with) as it allows you to assign the newly instantiated object. Use this when instantiating objects to which you need a moment's reference.
-
StructureToByteArray
Converts Structure To Byte-Array and back
-
Mascara CNPJ / CPF
Aplica mascara de CNPJ ou CPF brasileiro á uma string
-
As
A wrapper for DirectCast function.
-
toTrueFalse
Returns "True" or "False"
-
GetList(of TList)
Return object of Subclass of List(Of T) using FindAll method of List.
-
RemoveNonNumericCharacters
Removes any non numeric characters from a string. Overloads for allowing periods and commas to stay.
-
ToStream
Returns a stream when given a string
-
Swap
Swaps two variables/objects with each other
-
isDateBetween
Check if a given date is within another specified date range.
-
Shuffle
Shuffle-Method for randomizing IEnumerables (It's not the fastest method to do this, if that's important to you)
-
ToNullableString()
Calling Value.ToString on a Nullable(Of T) type where the value is null will result in an "Nullable object must have a value." exception being thrown. This extension method can be used in place of .ToString to prevent this exception from occurring.
-
ToBase64 / FromBase64
Convert string to/from Base64 encodeing
-
HasRecords
The idea is to have a method which spells out a question, are there any records which for some might be reading code easier
-
CurrentCellValue
This extension retrieves from the current row in a DataGridView a column value as a string. There are three ways to call this extension 1. No parameters returned the current active column for the active row. 2. Pass Column name for current active row. 3. Pass Column index for current active row.
-
ChangeCase
Change the text to TitleCase using the en-US culture
-
AppendLineFormat
Appends a formatted string and the default line terminator to to this StringBuilder instance.
-
ToArray
Converting XmlDocument to byte array and vice versa
-
RemoveDuplicateRows
This extension method will remove duplicate rows from the DataTable that it is called from.
-
ToShortName
Converts time span to its largest whole number time unit.
-
AddIfNotExists
An extension method for adding a value to a collection if it not exists yet.
-
NoDuplicates
Method to remove duplicate entries from either a string or integer array
-
ActualCommandText
Shows the SQL of the CommandText property but replaces all of the DB parameters with their actual values.
-
Extract
Extract string from a string
-
ToFormsColor
Converts a System.Windows.Media.Color (WPF) into System.Drawing.Color (WinForms) In mixed projects using Windows-Forms and WPF, there is sometimes the need to convert colors between both.
-
GetNext
Gets the next occurrence day of the week specified.
-
AddIfDoesntExist
Adds an item to a generic list if it doesn't exit.
-
IsPhoneFax
Check string that contains valid Phone / Fax
-
ToWpfColor
Converts a System.Drawing.Color (e.g. from a ColorDialog) into a System.Windows.Media.Color for WPF
-
ToXMLRPCStruct
This Extension Method is built to be used with XML-RPC.NET (http://www.xml-rpc.net/) Quick converting classes to lightwight xmlrpc structures. Correspondending structures are identified with attributes
-
IsInterval
Determines if the Integer is of the specified interval. E.g. if the interval is 100 and the integer is 400, it would return true. 127 would return false. This function uses the Mod operator, for the above example: (300 Mod 100 = 0)
-
BitmaptoIcon
Convert from bitmap to icon - use resource bitmaps for form icons
-
UcWords
Returns Title Cae. Capitalise first letter of each word
-
FromDelimitedString
Returns a string list from a delimited string where you provide the delimiter.
-
ExpandToWords
Expand a string such as a field name by inserting a space ahead of each capitalized letter (where none exists).
-
AddRightIfDoesntExist
Adds a value onto the end of the string if it does not already exist there.
-
TraverseFor
Returns the first inner exception you are looking for or null if not found.
-
GetLast
Gets the prior occurrence of the day of the week specified.
-
In
Strongly typed code version of the common IN clause for SQL.
-
DistanceToPoint
Calculates the distance between two points
-
AddLeftIfDoesntExist
Adds a value onto the beginning of a string if it does not already exist there.
-
GetTrackedObjects
A Linq-to-SQL DataContext does change tracking for all the objects it creates. This is so that it knows what to insert/update when you call .SubmitChanges(). Unfortunately, the DataContext doesn't supply that information to the world, but it's uber helpful to know at times, especially if you want to create a DAL that enforces writing to a changelog on every DB commit. This method examines the gruesome innards of the DataContext and gives you the
-
Right
Returns a string containing a specified number of characters from the right side of a string
-
NewIfNull
Shortcut to create an object if it's null
-
streamToImage
Converte Array stream em imagem
-
imgToBase64
converte imagem em base64
-
ImgToStream
converte imagem para stream
-
ZipToString
Descompactação de string
-
string to FolderName
Remove caracteres não permitidos para nomes de pastas
-
base64ToImage
Converte base64 image em imagem
-
StringToZip
Compactação de string utilizado geralmente para compactar Base64
-
ImageToIcon
Converte imagem do resources em icone
-
ArrayNullConditional
Checks the item in the array. If the index passed in is equal to size or larger than array NOTHING is returned. Otherwise returns STRING from the array. Could easily be extended to other types/objects, just change return type on extension from string to your needs.