Knebel Home
{ C# }
Binding a Drop-List to a Hashtable
Here is a brief example of the powerful tool named HashTable:
C#: Execute .bat files
This code will create a batch file and run it. Be sure to include the following classes: System.IO; //writes file System.Diagnostics; //runs process
Cookies!
The basics - cookies in .Net uses System.Web
Datagrid/Dataset example with DataRelationship (Windows)
This example shows you how to populate a datagrid, and assign a relationship to the underlying dataset which populates that datagrid.
Execute SQL DTS Packages from .Net
This example shows you how to execute a DTS package from C#. - Add a reference to the following DLL in .Net (change according to your SQL installation location): C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspkg.dll - Add to your clas...
Exposing Classes to Your Objects
Exposing your class to other objects is easy. This example shows you how to create an instance of an object having the ability utilize the object throughout your class.
Filling List Boxes Programmatically from SQL
Drag 2 listboxes onto a web form and set the IDs to lstFields and lstVals. Then put this in the code-behind:
Get the page name of a web page
This function extracts and returns the page name (without path) from the ServerVariables["SCRIPT_NAME"].
New Line (Multiline Textbox)
When creating a multi-line textbox (as an example), you can create a new line (carriage return / line feed) in 2 ways: One is similar to Javascript: \r\n You can also use the System.Environment.NewLine
Session Variables
Simple syntax example of session variables in .net
Strings: Replace method
Use the following function to replace these -> ' with the SQL equivalent, for inserts/updates.
User Control Example
Here is a quick example of using User Controls as a method of including repetitive information for each page (e.g. a page header).
Using CDO to Send Email in .Net
- Create a new Windows App (C#) - Add reference to CDO (using CDO) - Add the following text boxes: - txtTo (message to) - txtFrom (message from) - txtSubject (message subject) - txtBody (message body) - txtAttachFile (filename a...