| | | 
StrataFrame Novice
       
Group: StrataFrame Users Last Login: Yesterday @ 6:22:41 PM Posts: 106, Visits: 392 |
| | In VFP I enjoyed the comment / uncomment right click menu option for blocks of code. The closest I've been able to find in the VB 2008 IDE is a macro sample to comment and nothing to uncomment. Soooo, this may be old hat to experienced VS users but if you're a newbie like me you may find this useful : Tools / Customize / Macros 
Now you can drag that Samples.VSEditor.CommentRegion right onto a toolbar. Then, with the Customize dialog still open, right click on what you dragged onto the bar and select Default Style 
Which will reduce it to a blank icon and then pick Chang Button Image to give it an icon. Okay, now if you hightlight a block of text in code it will all be commented out with single quotes But what of uncommenting ? I wrote this macro which you can paste into the macro file that comes up when you open the Macros IDE ( you can drag that out of Tools in customize and onto a menu ) Sub UncommentBlock()Dim current As Stringcurrent = DTE.Activedocument.Name DTE.ExecuteCommand( "Edit.Find")DTE.ExecuteCommand( "Edit.SwitchtoQuickReplace")DTE.ExecuteCommand( "Edit.SelectAll")DTE.Windows.Item(current).Activate() DTE.Find.FindWhat = "'"DTE.Find.ReplaceWith = ""DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocumentSelection DTE.Find.MatchCase = FalseDTE.Find.MatchWholeWord = FalseDTE.Find.MatchInHiddenText = TrueDTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone DTE.Find.Action = vsFindAction.vsFindActionReplaceAll If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) ThenThrow New System.Exception("vsFindResultNotFound")End IfDTE.Windows.Item( "{CF2DDC32-8CAD-11D2-9302-005345000000}").Close()End Sub Just does a search and replace for ' inside a highlighted block As soon as you save the macro file, you'll find that one the same place you found the CommentRegion() and you can put it on a toolbar the same way. I'll put the tasklist thing in a separate message. |
| | | | 
StrataFrame Novice
       
Group: StrataFrame Users Last Login: Yesterday @ 6:22:41 PM Posts: 106, Visits: 392 |
| And here's the comment / task list token macro :'And you can customize this even further by using YOUR initials instead of mine :-) Sub InsertCRH() Dim textSelection As EnvDTE.TextSelection textSelection = CType(DTE.Activedocument.Selection(), EnvDTE.TextSelection) textSelection.Text = "' CRH: " & System.DateTime.Now.ToString() & CrLf _ & "' " End Sub
See prior message for putting it on a toolbar and my message about snippets in General .NET section to see about the method and reasons to put your initials into a task list token Charles |
| | | | StrataFrame VIP
       
Group: StrataFrame Users Last Login: Yesterday @ 6:42:41 PM Posts: 1,058, Visits: 2,581 |
| Do you know about the keyboard shortcuts?
Highlight the code desired and then
Ctl +k+c to comment
Ctl +k+u to uncomment |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 3:24:00 PM Posts: 3,733, Visits: 3,926 |
| Do you know about the keyboard shortcuts?
Highlight the code desired and then Ctl +k+c to comment Ctl +k+u to uncomment Very close and personal friends  |
| | | | 
StrataFrame Novice
       
Group: StrataFrame Users Last Login: Yesterday @ 6:22:41 PM Posts: 106, Visits: 392 |
| Do you know about the keyboard shortcuts? Obviously no  Seemed like there should be something like that but darned if I could find them ( where shoulld I have been looking to find a list of such shortcuts? ) Oh well, learned a lot of cool stuff about macros along the way. Goes along with my life maxim that most of the valuable stuff I know I learned on my way to looking up something else  |
| | | | 
StrataFrame Novice
       
Group: StrataFrame Users Last Login: Yesterday @ 6:22:41 PM Posts: 106, Visits: 392 |
| | | | | 
Advanced StrataFrame User
       
Group: StrataFrame Users Last Login: Yesterday @ 4:54:54 PM Posts: 551, Visits: 10,431 |
| Hey, thanks for the links Charles. |
| | | | StrataFrame VIP
       
Group: StrataFrame Users Last Login: Yesterday @ 6:42:41 PM Posts: 1,058, Visits: 2,581 |
| Goes along with my life maxim that most of the valuable stuff I know I learned on my way to looking up something else 
Ahmen! And I learned a lot about marcos from your example |
| |
|
|