05/05/2014 by Nitesh

How To Limit Dates in DateTimePicker Control in Windows Forms

Dear Friends, Another small tip that may help in day-to-day code development. When working with DateTimePicker controls in Windows forms, we come across a situation where we need to block the control to have a minimum and maximum dates. For example, the DOB field cannot have dates greater than today and DateOfLeavingCompany field cannot have…

Continue Reading »

28/04/2014 by Nitesh

How To Round a decimal value to 2 decimal places in C#

Friends, This is a very basic post that will explain few ways of restricting a decimal value to 2 decimal places in C#. Normally, we need to output the decimal values to 2 precision numbers. However, sometimes we also need to restrict the decimal variable itself to store not more than 2 decimal values (For…

Continue Reading »

10/01/2014 by Nitesh

How to Move a Windows Form By Dragging

Friends, Today, I was working on a Desktop application where I was required to drag a form by Mouse left click as we do in normal drag and drop operations. the only difference in this scenario was I needed to drag the entire form and the form was not supposed to be dropped anywhere else….

Continue Reading »

10/01/2014 by Nitesh

How to Get Width & Height of Desktop in WinForms

Friends, In certain scenarios we need to know the screen resolution our desktop application will be running on. To get this information, Microsoft provides us with a very handy class namely SystemInformation that can be found in System.Windows.Forms namespace. Using this class, we can almost every information about the current system environment, the application is…

Continue Reading »

09/01/2014 by Nitesh

How to Dock/Display Windows Form on Top of all Applications on Desktop

Friends, Most of us have seen and used TeamViewer. When TeamViewer starts, it displays a small window at the right bottom of the Desktop that remains on top of all the applications that we open on our computer. The TeamViewer icon looks something similar to the image shown below. You can achieve this feature in…

Continue Reading »

1 2 3