Showing posts with label .NET Programming. Show all posts
Showing posts with label .NET Programming. Show all posts

Saturday, September 1, 2012

Auto formatting the code in Visual Studio


- CTRL-A to select the whole text.
- Ctrl+K- Ctrl + F


 Before Auto Format
Ctrl - A selects the whole text
Ctrl K + Ctrl F, auto formats the whole text

Thursday, May 31, 2012

String to Double issues in C# .NET


If you are simply using 

double test = Double.Parse("12.45");

and it doesn't work due to formating issues, here is the right post for you. Almost certainly you're using the wrong CultureInfo. Try specifying CultureInfo.InvariantCulture to parse in. I suspect it's currently assuming that "." is a thousands separator rather than a decimal point.

CultureInfo Invc = new CultureInfo("");
Invc = CultureInfo.InvariantCulture;

x1 = Double.Parse("12.45", Invc);

alternative:

x1 = Double.Parse("12.45", CultureInfo.InvariantCulture);

Wednesday, May 30, 2012

Tab Order in C# Windows Form - Visual Studio 2010

Setting Tab order in C# (Visual Studio 2010):

1 - Select View - Tab Order. This activates the tab-order selection mode on the form. A number (representing the TabIndex property) appears in the upper-left corner of each control.
2-  Click the controls sequentially to establish the tab order you want.
3 - When you are done, click View - Tab Order to deactivate the indexing.

Source: http://msdn.microsoft.com/en-us/library/bd16a8cw.aspx

Wednesday, April 11, 2012

Visual Studio shortcut for commenting program lines

Ctrl-K, Ctrl-C – Comments selected text
Ctrl-K, Ctrl-U – De-Comment selected text