Quantcast
Channel: Technical Blog
Browsing index pages (25 articles)
↧

Image may be NSFW.
Clik here to view.

How to host WCF service in IIS manager

To host the WCF service, follow the below steps:Add virtual directory in "IIS Manager"PC Name -> Sites -> Default Web Site -> Add virtual directoryType in the alias (name) and browse to the...

View Article


How to Enable, Disable and Start the task of task scheduler in C#.Net

Below function demonstrates how to enable, disable and run the already created scheduled task. It will first check if the task exists in task scheduler:public static void...

View Article


How to load registry hive of logged off users in C#.Net

In HKEY_USERS, SIDs of only logged in users are present by default. If you need to make changes in any user's registry in logged off state, you will have to load the registry hive of that particular...

View Article

How to clear clipboard text using C#.Net

Known exceptions:Case 1:It you use Clipboard.SetText(string.Empty) to clear clipboard text, you will get an ArgumentNullException exception: "Value cannot be NULL".It is because you cannot set empty...

View Article

How to get Clipboard data and its size in C#.Net

Following function will get the clipboard data:        [DllImport("user32.dll")]        static extern IntPtr GetClipboardData(uint uFormat);        [DllImport("user32.dll")]        static extern bool...

View Article


Get startup programs of all users using C#.Net

The below code will demonstrate how to list all the startup programs (also listed in msconfig) using C#.Net.A custom class (cStartupPrograms) is added to store a startup program and it's relevant...

View Article

Convert content of XML file to JSON string in C#.Net

The below function will convert the content of XML file to JSON string:private string convertXMLToJSON()        {            string xmlLogPath = "<<Path to the xml file>>";            //...

View Article

Start and stop a console application using C#

Start a console application:System.Diagnostics.Process aspProcess = null;private void start_console_app()        {            try            {                string pathToExe = @"<<Path to the...

View Article


Image may be NSFW.
Clik here to view.

How to make the Windows Desktop application work well on High-DPI Displays...

If you change the DPI of your machine from 100% to any other higher value, your desktop applications may appear somewhat blurry when you compare them with other applications on the screen. Alternately,...

View Article


How to extract the associated icon of any file in C#.Net

To extract icon of any file, define the below class and the structure:[StructLayout(LayoutKind.Sequential)]        public struct SHFILEINFO        {            public IntPtr hIcon;            public...

View Article

Dealing with “Application has stopped responding” issue in C#.Net

Suppose in your application, on a click event you are doing some calculations which is taking a lot of time. During that time, if a user perform unnecessarily clicks on the screen, it might give a...

View Article

Image may be NSFW.
Clik here to view.

Adding a new item to context menu of Windows Explorer in C#.Net

Requirement: Whenever user right clicks on any folder in windows explorer, display a new option and if user selects that option, launch your application. The below steps will add a new option on right...

View Article

Enumerate folder with “No Name” (blank space folder, AKA non-breaking space)...

A folder with no name can be created by following the below steps:Right-click on the folder and select Rename.Now press the Alt key and from the Numeric keypad, press 0160.Now press Enter or click...

View Article


Reduce flickering from controls in C#.Net

Flickering effect can be reduced by double buffering the controls. The below code will help you in reducing the flickering effect from any type of control.public static class ControlExtensions    {...

View Article

Article 2

Copy, Move and Delete Files and Folders in C#:Below are the commonly used methods (using “System.IO” namespace):For deleting: File:          File.Delete(“Path to the file”); Folder:...

View Article


Image may be NSFW.
Clik here to view.

Get the size of files having long path in C#.Net 3.5

Get the size of files having long path in  C#.Net 3.5Suppose you want to get the size of all the files present in a directory. You would do something like this:Method 1:DirectoryInfo di =...

View Article

Image may be NSFW.
Clik here to view.

Dealing with PathTooLongException while scanning files with long paths in C#

Suppose you have a list of object of class ‘FileInfo’. This class provide properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of...

View Article


Determining the owner of a file\folder in C#.Net and handling with general...

Determining the owner of a file\folder in C#.NetIn order to determine the owner of a file/folder, you would need to use the classes from the following namespaces:using System.IO;using...

View Article

Image may be NSFW.
Clik here to view.

Exporting datagrid to CSV using Save Dialog in C#.NET

Below is the code for exporting the data of a data grid in C#.NetDatagrid is as follows:System.Windows.Forms.SaveFileDialog saveDlg = new System.Windows.Forms.SaveFileDialog();...

View Article

Image may be NSFW.
Clik here to view.

Exporting data grid to Excel with Save Dialog box in C#.Net

I’ve the following data grid (say comparisonGrid) and I'll export this data into excel by following the below steps.Step 1: Include the following namespace to your code behind file (.cs file)using...

View Article
Browsing index pages (25 articles)


Latest Images