in

MCW Technologies' Community Server

Downloads, blogs, forums, and more

Adventures in Visual Studio Development

Making Visual Studio easier to use, one blog entry at a time

Tips and Tricks You May or May Not Already Know

I've been using Visual Studio .NET since it was in short pants, yet I saw something last week I didn't know you could do. I was at the MSDN Event in Lakewood (a suburb of Tacoma, which is about an hour south of Seattle). Rory Blyth was the presenter (and a good one too). I several times saw Rory deleting entire lines of code using nothing but the keyboard. And he wasn't selecting the line of code first. I had no idea how he was doing it. Turns out that if you have the cursor at the beginning of a line of code you can Ctrl-X and the line is cut.

I did not know that. Is it because I would prefer to use the mouse and only use the keyboard if I have to? Maybe. Is this something everybody knows and I am now the next to last person on the planet to have figured this out? Hope not! There are lots of these little things in the product and I never tire of learning them.

Here's one you probably don't know. In VS 2005, create a Data Source. Drag a table from the Data Sources window (drag it after specifying Details rather than Grid). You get data bound textboxes (eg CustomerIDTextBox) and data labels (eg CustomerIDLabel). Very nice. Now write some code to change the data labels to red. You can't. Type Me. and CustomerIDTextBox appears, but CustomerIDLabel does not. The following code

CustomerIDLabel.ForeColor = Color.Red 

generates an error. CustomerIDLabel is not declared. This is because the GenerateMember property of data labels is set to False when you drag and drop from the Data Sources window. GenerateMember determines whether or not a member variable is created. Change GenerateMember to True for CustomerIDLabel and now the code above is fine and CustomerIDLabel appears in IntelliSense.

 

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
© Copyright MCW Technologies, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems