Category - C#.Net
4 Comments   112940 Views
Here Mudassar Ahmed Khan has explained how to use parameterized queries to query SQL Server database in order to avoid SQL Injection attacks
1 Comments   71452 Views
Here Mudassar Ahmed Khan has explained how to export data to Microsoft Excel workbook using ADO.Net and C#
1 Comments   40199 Views
Here Mudassar Ahmed Khan has explained how to make AJAX Calls using JavaScript and XMLHttp to fetch data from server in ASP.Net
1 Comments   44185 Views
Here Mudassar Ahmed Khan has explained how to use AJAX JavaScript and XMLHttp to query the server and find out whether user name already exists in the database using C and Vb.Net
11 Comments   116734 Views
Here Mudassar Ahmed Khan has explained how to read and import data to Microsoft Excel workbook using ADO.Net and C#
12 Comments   62959 Views
Here Mudassar Ahmed Khan has explained how to send emails using C# and asp.net. He has also explained how to send emails on a new thread to improve performance.
10 Comments   51901 Views
Here Mudassar Ahmed Khan has explained how to attach files to email without saving them onto the disk directly from the FileUpload stream
79 Comments   262341 Views
Here Mudassar Ahmed Khan has explained how to save file as binary data inside SQL Server database and also how to retreive them and reconvert to their respective formats using VB.net amd C#.
52 Comments   461561 Views
Here Mudassar Ahmed Khan has explained how to retrieve and display images that are stored in SQL Server Database in ASP.Net Web application
10 Comments   85453 Views
Here Mudassar Khan has explained How to display images that are stored outside the Website Root Folder
18 Comments   94549 Views
Here Mudassar Ahmed Khan has explained how to pull RSS from a website and display the same on the web page using ASP.Net
10 Comments   133921 Views
Here Mudassar Ahmed Khan has explained how to find the control that caused the postback in ASP.Net
22 Comments   61291 Views
Here Mudassar Ahmed Khan has explained how to call parent page method from child user control placed on the same page whose function or method we want to call.
2 Comments   21496 Views
Here Mudassar Ahmed Khan has explained how to Populate and Bind Custom Business Objects or properties collection to databound controls like ASP.Net GridView Control
5 Comments   24953 Views
Here Mudassar Ahmed Khan has explained how to bind an XML or XML File to ASP.Net DropDownList Control using DataSet in C# and VB.Net
0 Comments   49179 Views
Here Mudassar Ahmed Khan has explained how to preserve values or states of custom properties across postbacks in ASP.Net
3 Comments   30625 Views
Here Mudassar Ahmed Khan has explained how to make use of the new feature Parallelism in .Net 4.0 making use of the new classes Parallel and PLINQ (Parallel LINQ)
4 Comments   189915 Views
Here Mudassar Ahmed Khan has explained how to list the installed instances of SQL Server on machine and LAN Network using C# and VB.Net
18 Comments   92702 Views
In this article Mudassar Ahmed Khan has explained how to read emails from POP3 server using OpenPop.Net Library using C# and VB.Net
11 Comments   51721 Views
In this article Mudassar Ahmed Khan has explained how to read emails from POP3 server using OpenPop.Net Library using C# and VB.Net
1 Comments   11983 Views
Here Mudassar Ahmed Khan has explained the difference between string and String keywords in C# and also the difference between bool and Boolean class.
20 Comments   150632 Views
Here Mudassar Ahmed Khan has explained how to create and send HTML Formatted Emails in ASP.Net using C# and VB.Net
Here Mudassar Ahmed Khan has explained how to implement the free ASP.Net Mathematical Captcha Control in C# and VB.Net
Here Mudassar Ahmed Khan has explained the exception DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID' in ASP.Net
10 Comments   75026 Views
Here Mudassar Ahmed Khan has explained how to modify the ASP.Net WCF (Windows Communication Foundation) service to make it accept AJAX JSON calls and to make AJAX JSON calls to ASP.Net WCF Service using JavaScript and jQuery
0 Comments   28204 Views
Here Mudassar Ahmed Khan has explained how to get distinct list of custom business class objects using LINQ Query in .Net
5 Comments   56125 Views
Here Mudassar Ahmed Khan has explained how to convert Text string to Image using C# and VB.Net in ASP.Net Web application and display the converted image in Image Control
3 Comments   43093 Views
Here Mudassar Ahmed Khan has explained how to programmatically add and update SQL connection strings in ASP.Net Web.Config file using C# and VB.Net.
He has explained how we can access and update the different attributes of a connection string like DataSource, IntitialCatalog, UserId, Password and IntegratedSecurity.
9 Comments   99976 Views
Here Mudassar Ahmed Khan has explained how to fetch and read email messages with attachments from GMAIL POP3 mail server inbox in ASP.Net. The fetched emails are bound to ASP.Net GridView and users are able to download the attachments.
6 Comments   83724 Views
Here Mudassar Ahmed Khan has explained how to send Rich Text HTML Emails with embedded images and pictures using VB.Net and C# in ASP.Net
Here Mudassar Ahmed Khan has explained how to create dynamic button controls at runtime and also attach OnClick event handlers to the dynamically generated buttons in Windows Forms (WinForms) Application using VB.Net and C#.
2 Comments   61162 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code how to minimize Windows Application to System Tray using VB.Net and C#.
0 Comments   58965 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to Populate bind GridView with Generic List in ASP.Net using C# and VB.Net.
Generic Lists are created from Custom Business Objects also known as Property Class
0 Comments   27408 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to bind Generic List to GridView in ASP.Net using C# and VB.Net.
Generic Lists are created from Custom Business Objects also known as Property Class
0 Comments   19404 Views
Here Mudassar Ahmed Khan has explained with an example, how to delete folder or directory using C# and VB.Net
A Directory that contains files or folders cannot be deleted hence this code first deletes all the Child Directories and also all the files in the Directory as well the Child Directories.
0 Comments   25962 Views
Here Mudassar Ahmed Khan has explained with an example, how to recursively all delete all directories (sub directories or folders or sub folders) in C# an VB.Net
0 Comments   10771 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code,
how to send emails using GMAIL Account Credentials in ASP.Net using C#.
0 Comments   50419 Views
Here Mudassar Ahmed Khan has explained, how to populate DropDownList from XML file in ASP.Net
7 Comments   56900 Views
Here Mudassar Ahmed Khan has explained, how to send email with attachment in ASP.Net.

The file to be send as attachment along with mail will be uploaded using FileUpload control and will be dynamically added as attachment in the MailMessage class object without saving in any folder on disk.

For this example, for sending emails Gmail SMTP Mail Server will be used. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
1 Comments   51481 Views
Here Mudassar Ahmed Khan has explained, how to remove (delete) duplicate rows (records) from DataTable using DataView in C# and VB.Net.

The idea is to convert the DataTable to DataView and then from DataView back to DataTable using the DataView ToTable method which has option to return distinct (unique) rows (records) of DataTable, thus ultimately it removes (deletes) duplicate rows (records).
4 Comments   72083 Views
Here Mudassar Ahmed Khan has explained, how to add dynamic controls like Label, TextBox, Button, etc. to Windows Forms ( WinForms ) Application on click of a Button.

He has also explain how we can attach event handler to various dynamically added controls like TextBox, Button, etc.
0 Comments   13976 Views
Here Mudassar Ahmed Khan has explained with an example, how to recursively all delete files in all directories (sub directories or folders or sub folders) in C# and VB.Net
4 Comments   141628 Views
Here Mudassar Ahmed Khan has explained, how to dynamically (programmatically) at runtime create a DataTable using C# or VB.Net and then bind it to GridView in ASP.Net.

First a dynamic DataTable object is created and its schema (Table structure and Columns) is defined programmatically. Once the columns are defined, then rows (records) are added to the dynamically generated DataTable.

Once the dynamic DataTable is populated with records, it is bound to an ASP.Net GridView control.
1 Comments   48644 Views
Here Mudassar Ahmed Khan has explained, how to dynamically create DataTable and bind to GridView in ASP.Net using C# and VB.Net
25 Comments   94871 Views
Here Mudassar Ahmed Khan has explained, the difference between ArrayList and Generic List (List) in C# .Net and VB.Net.
7 Comments   30268 Views
Here Mudassar Ahmed Khan has explained, how to send email with attachment in ASP.Net.

The file to be send as attachment along with mail will be uploaded using FileUpload control and will be dynamically added as attachment in the MailMessage class object without saving in any folder on disk.

For this example, for sending emails Gmail SMTP Mail Server will be used. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
16 Comments   156115 Views
Here Mudassar Ahmed Khan has explained how to use and return value from Stored Procedure using Output Parameter in ASP.Net.

For this article I a Table named Fruits is used which contains FruitId and FruitName columns. The name of the Fruit is fetched using Output Parameter in SQL Server Stored Procedure in ASP.Net
3 Comments   39991 Views
Here Mudassar Ahmed Khan has explained how to programmatically add, modify (change) and update SQL connection strings at runtime in ASP.Net Web.Config file using C# and VB.Net.

He has explained how we can access and update the different attributes of a connection string like DataSource, IntitialCatalog, UserId, Password and IntegratedSecurity.
3 Comments   50437 Views
Here Mudassar Ahmed Khan has explained how to encrypt and decrypt file such as Word (DOC, DOCX), Excel (XLS, XLSX), PDF, Text (TXT) documents or JPG, PNG or GIF Images using C# and VB.Net in ASP.Net website.

The file will be uploaded for Encryption and Decryption of Files. For Encryption and Decryption of files, the AES Symmetric key (Same key) algorithm is used. The encrypted and decrypted files can be saved inside folders on disk or can be downloaded to client user.
0 Comments   47896 Views
Here Mudassar Ahmed Khan has explained how to modify the ASP.Net WCF (Windows Communication Foundation) service to make it accept AJAX JSON calls and to make AJAX JSON calls to ASP.Net WCF Service using JavaScript and jQuery
3 Comments   71811 Views
Here Mudassar Ahmed Khan has explained how to read Excel File using OLEDB Data Provider Connection in C# .Net. Excel Workbook is just like database with sheets corresponding to tables.
This article covers reading of both Excel 2003 as well as OpenXML i.e. Excel 2007, 2010 and 2013 formats.
1 Comments   23940 Views
Here Mudassar Ahmed Khan has explained how to preserve or persists data / class objects / variable values across PostBacks in ASP.Net.

This is done by saving the data / class objects / variable in a ViewState object and then fetching it from it whenever needed.
3 Comments   20576 Views
Here Mudassar Ahmed Khan has explained how to encrypt and decrypt XML File using C# and VB.Net.

The XML file will be uploaded for Encryption and Decryption of Files. For Encryption and Decryption of files, the AES Symmetric key (Same key) algorithm is used. The encrypted and decrypted files can be saved inside folders on disk or can be downloaded to client user.
10 Comments   34360 Views
Here Mudassar Ahmed Khan has explained how to send or pass DataTable as parameter to Stored Procedure in C# and VB.Net using the SQL Server User Defined Table Type.

The User Defined Table Type has to be created in SQL Server and it must have the same schema as that of the DataTable that we need to pass to the Stored Procedure as parameter.
0 Comments   18984 Views
Here Mudassar Ahmed Khan has explained how to display ‘st’, ‘nd’, ‘rd’ and ‘th’ suffix after day numbers in Formatted Date string using C# and VB.Net.

By default .Net does not have any provision to display the display ‘st’, ‘nd’, ‘rd’ and ‘th’ suffix after day numbers in Formatted Date string and hence I have come up with a generic method for accomplishing the task.
3 Comments   25507 Views
Here Mudassar Ahmed Khan has explained how to dynamically generate PDF in Memory from HTML using iTextSharp and send the generated PDF as Email Attachment using C# and VB.Net.

Using iTextSharp Library, the PDF is generated from HTML string in memory by making use of MemoryStream class and then the same is attached to the MailMessage object and send as email attachment.
3 Comments   43085 Views
Here Mudassar Ahmed Khan has explained how to read and write BLOBs (Binary Large Objects) data to SQL Server database using C# and VB.Net.

BLOBs include files such as Images, PDF, Word or Excel Documents, Audio, Video files. Such files are read converted to an array of bytes and inserted into SQL Server VARBINARY or IMAGE fields.
0 Comments   31695 Views
Here Mudassar Ahmed Khan has explained how to dynamically create PDF from HTML string using iTextSharp and send the generated PDF as Email Attachment in ASP.Net using C# and VB.Net.
1 Comments   33720 Views
Here Mudassar Ahmed Khan has explained with a simple example how to use Parallel ForEach Loop in C# and VB.Net using .Net 4.0 and .Net 4.5.

Parallelism can be achieved in two ways
1. Parallel class
2. PLINQ (Parallel LINQ)

Here he has explained how to achieve parallelism using Parallel ForEach Loop.
0 Comments   10963 Views
Here Mudassar Ahmed Khan has explained what is Parallel LINQ (PLINQ) and a simple example how to write a PLINQ Query in C# and VB.Net .Net 4.0 and .Net 4.5.

Parallelism can be achieved in two ways
1. Parallel class
2. PLINQ (Parallel LINQ)

Here he has explained how to achieve parallelism using Parallel LINQ (PLINQ).
3 Comments   16851 Views
Here Mudassar Ahmed Khan has explained with an example, how to pass Table Valued Parameters to SQL Server Stored Procedure from .Net Code Behind using ADO.Net, C# and VB.Net.
1 Comments   25541 Views
Here Mudassar Ahmed Khan has explained how to pass multiple records (rows) to a Stored Procedure in SQL Server using C# and VB.Net.
We can pass a Table containing multiple records (rows) to a Stored Procedure by making use of Table Valued parameters in SQL Server.
0 Comments   13959 Views
Here Mudassar Ahmed Khan has explained how to save file as binary data inside SQL Server database and also how to retrieve them and convert them back to their respective formats using C# and VB.Net.
1 Comments   25847 Views
Here Mudassar Ahmed Khan has explained how to save image as binary data into SQL Server database and also how to retrieve and convert the image back to their respective formats using C# and VB.Net.
1 Comments   9694 Views
Here Mudassar Ahmed Khan has explained how to create text image on the fly with ASP.Net using C# and VB.Net.

The image generation is done dynamically using GDI+ library in ASP.Net.
0 Comments   25454 Views
Here Mudassar Ahmed Khan has explained how to export data (records) from SQL Server Table to Text (Notepad) file in ASP.Net using C# and VB.Net. This article will work for all SQL Server versions i.e. 2005, 2008, 2008R2, 2012, etc.

The data will be first fetched into a DataTable and then the DataTable will be exported to a Text file which can be viewed in Notepad.
Here Mudassar Ahmed Khan has explained how to export DataGridView data to Excel file in Windows Forms (WinForms) Applications using OpenXml and ClosedXml Excel conversion libraries, C# and VB.Net.

DataGridView cannot be exported directly to Excel file and hence need to generate a DataTable and export the DataTable to Excel file.
0 Comments   10363 Views
Here Mudassar Ahmed Khan has explained how to Rotate / Flip / Transpose DataTable - Convert DataTable Columns to Rows and Rows to Columns using C# and VB.Net.
He has also explained how we can get back the original DataTable from the Rotated / Flipped / Transposed DataTable using C# and VB.Net.
3 Comments   13518 Views
Here Mudassar Ahmed Khan has explained how to insert (save) Hindi, Marathi, Gujarati, Urdu, Persian, Arabic, Tamil and Telugu languages Text characters in SQL Server database using ASP.Net, C# and VB.Net.

In SQL Server database we will need to use NVARCHAR data type to store the various languages text characters.
1 Comments   10958 Views
Here Mudassar Ahmed Khan has explained how to dynamically generate and display barcode image in Windows Forms (WinForms) Application using C# and VB.Net.
0 Comments   5224 Views
Here Mudassar Ahmed Khan has explained how to Rotate / Flip / Transpose DataTable - Convert DataTable Columns to Rows and Rows to Columns using C# and VB.Net.
He has also explained how we can get back the original DataTable from the Rotated / Flipped / Transposed DataTable using C# and VB.Net.
4 Comments   15318 Views
Here Mudassar Ahmed Khan has explained how to add page numbers to existing PDF file using iTextSharp in C# and VB.Net.
The pages of the PDF file will be read and then using the PdfStamper class page numbers will be written to each page of the PDF document.
0 Comments   2563 Views
Here Mudassar Ahmed Khan has explained a tutorial with example on how to use the JavaScript XmlHttpRequest to make Asynchronous calls to the server and fetch data.
2 Comments   39554 Views
Here Mudassar Ahmed Khan has explained with examples, how to calculate Sum (Total) of DataTable Columns using C# and VB.Net.

This article explains how to calculate Sum (Total) of DataTable Columns using the following two methods.
1. DataTable Compute function.
2. Using LINQ.
0 Comments   10666 Views
Here Mudassar Ahmed Khan has explained how to create and drop (delete) SQL Server Table programmatically using ADO.Net, C# and VB.Net.

The Create and Drop script will be dynamically generated and the Table will be respectively created or deleted in SQL Server database.
0 Comments   13057 Views
C#.Net   VB.Net   XML
Here Mudassar Ahmed Khan has explained with examples, how to use XPath with XmlDocument and how to select XML nodes by Name and Attribute value using XPath expression in C# and VB.Net.
0 Comments   2343 Views
Here Mudassar Ahmed Khan has explained a short article to clear a common doubt faced by developers i.e. what is the difference between small string and capital String data types in C# .Net.
0 Comments   2284 Views
Here Mudassar Ahmed Khan has explained a short article to clear a common doubt faced by developers i.e. what is the difference between bool and Boolean data type in C# .Net.
0 Comments   8366 Views
Here Mudassar Ahmed Khan has explained with example, how to read binary data files and convert them to their respective file formats and write the files as binary data and save it to database.
0 Comments   13765 Views
Here Mudassar Ahmed Khan has explained how to convert / copy DataReader (SqlDataReader) data to DataTable and DataSet using C# and VB.Net.
The DataTable and DataSet will be populated with records from the DataReader using Load method of the DataTable.
Here Mudassar Ahmed Khan has explained how to call (consume) Web Service (ASMX) in Windows Forms (WinForms) application using C# and VB.Net.
Here Mudassar Ahmed Khan has explained how to call (consume) Web Service (ASMX) in Console application using C# and VB.Net.
1 Comments   11864 Views
Here Mudassar Ahmed Khan has explained how to send HTML Page (File) as Email Body in ASP.Net using C# and VB.Net.
0 Comments   7397 Views
Here Mudassar Ahmed Khan has explained how to attach a File from MemoryStream to MailMessage object and send as email attachment in ASP.Net using C# and VB.Net.
This article will explain how to attach a PDF file from MemoryStream to MailMessage object and send as email attachment in ASP.Net using C# and VB.Net.
0 Comments   7090 Views
Here Mudassar Ahmed Khan has explained with an example, how to convert Byte Array to Base64 String using C# and VB.Net.
0 Comments   14513 Views
Here Mudassar Ahmed Khan has explained how to insert and retrieve images from SQL Server database without using Stored Procedures using C# and VB.Net.
Here Mudassar Ahmed Khan has explained with an example, how to populate (fill) DataTable and DataSet using DataReader (SqlDataReader) in C# and VB.Net.
The DataTable and DataSet will be populated with records from the DataReader using Load method of the DataTable.
1 Comments   13957 Views
Here Mudassar Ahmed Khan has explained with an example, how to insert (save) to SQL Server Table in C# and VB.Net using the SQL Server User Defined Table Type.
0 Comments   9714 Views
Here Mudassar Ahmed Khan has explained with an example, how to generate unique Random Strings containing Letters and Numbers (AlphaNumeric) and Numbers (Numeric) in ASP.Net using C# and VB.Net.
The unique Random Strings containing Letters and Numbers (AlphaNumeric) and Numbers (Numeric) will be generated in variable lengths such as 5, 8 and 10 characters in ASP.Net using C# and VB.Net.
Here Mudassar Ahmed Khan has explained with an example, how to implement a Windows Forms (WinForms) Application with System Tray Icon using C# and VB.Net.
Here Mudassar Ahmed Khan has explained with an example, how to export DataTable to Excel using OpenXml and ClosedXml Excel conversion libraries in Windows Forms (WinForms) Applications using C# and VB.Net.
0 Comments   3278 Views
Here Mudassar Ahmed Khan has explained with an example, how to bind (populate) GridView using Class Property in ASP.Net using C# and VB.Net.
A Generic List of Property Class objects (Custom Business objects) will be used to bind (populate) GridView in ASP.Net using C# and VB.Net.
0 Comments   836 Views
Here Mudassar Ahmed Khan has explained with an example, how to convert Image file to Base64 encoded string in C# and VB.Net.
0 Comments   710 Views
Here Mudassar Ahmed Khan has explained with an example, how to convert (save) Byte Array as File in ASP.Net using C# and VB.Net.
The Byte Array will be converted (saved) as File using the File class in C# and VB.Net.
0 Comments   876 Views
Here Mudassar Ahmed Khan has explained with an example, how to convert (save) Byte Array as Image in ASP.Net using C# and VB.Net.
The Byte Array will be converted (saved) as Image using the File class in C# and VB.Net.
Here Mudassar Ahmed Khan has explained with an example, how to create a System Tray Windows (WinForms) Desktop Application using Notification Icon in C# and VB.Net.