DataGridView Filter & Expressions C# 5.0


Often we need to filter a DataGridView in our database programs. The C# datagrid is the best tool for database display & modification. There is an easy shortcut to filtering a DataTable in C# for the DataGridView. This is done by simply applying an expression to the required column. The expression contains the value of the filter to be applied. The filtered DataTable must be then set as the DataSource of the DataGridView.


Stream Writer in C#.5.0

The  StreamWriter is used to write data to the hard disk. The data may be in the form of Strings, Characters, Bytes etc. Also you can specify he type of encoding that you are using. The Constructor of the  StreamWriter class takes basically two arguments: The first one is the actual file path with file name that you want to write & the second one specifies if you would like to replace or overwrite an existing file.The  StreamWriter creates objects that have interface with the actual files on the hard disk and enable them to be written to text or binary files. In this example we write a text file to the hard disk whose location is chosen through a save file dialog box.

Send an Email through C# 5.0


The .Net Framework has fantastic support for web applications. The System.Net.Mail can be used to send Emails very easily. All you require is a valid Username & Password that you use to log into your email account. Attachments of various file types like PNG and JPEG can be very easily attached with the body of the mail.  Below is a function shown to send an email if you are sending through a gmail account. The default port number is 587 & is checked to work well in all conditions.