CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: NewsGroup Date Entered: 7/10/2007 12:09:28 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 11 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
speednet
Asp.Net User
Counting Highlighted Characters in VS2005 Editor7/10/2007 12:09:28 PM

0/0

If this feature does not exist, I would like to register it as a much-needed feature request.

I am looking for a very simple feature which displays the number of characters I have highlighted on the screen in the code editor.  Many editors, such as the wonderful Notepad++, and I find myself transfering text into that editor just to count the number of characters.

An example of when I need this feature:  I am declaring a new StringBuilder, and I want to give the buffer a default size, so that it doesn't need to increase unnecessarily.  I highlight the block of text that will be the approximate final contents of the StringBuilder, and add a hundred extra bytes or so, depending on the specific needs of the operation.  This should be a simple matter, but I can't find a way to do it in VS2005 right now.

Does anyone have a solution?  If not, can it be added to a suggested feature list?

Thanks!


http://blogs.lotterypost.com/speednet
ps2goat
Asp.Net User
Re: Counting Highlighted Characters in VS2005 Editor7/10/2007 1:48:36 PM

0/0

You can create a Macro, then place that macro in your tool bar and/or menus in order to have it readily available.  You can also configure it with a hot key combination.

Here's the code for a quick and dirty macro, but you may run into problems if you have spacing between lines (i.e., indentions in your code.):

 

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Imports Microsoft.VisualBasic

Public Module Module1

    Sub CountSelection()
        Dim str As String = DTE.ActiveDocument.Selection.Text()
        Microsoft.VisualBasic.MsgBox("Number of Characters Counted: " & vbCrLf & _
             str.Length, MsgBoxStyle.OkOnly, "Number Of Selected Characters")
    End Sub

End Module
 
---------------------------------------
MCP - Web Based Client Development .NET 2.0
speednet
Asp.Net User
Re: Counting Highlighted Characters in VS2005 Editor7/10/2007 2:13:28 PM

0/0

Fantastic, thanks very much!

I tested it, and it seems to do the trick nicely.  If I run into problems, I'll just make the counting mechanism more robust by using Regular Expressions.

Thanks again -- for the very quick and helpful assistance!


http://blogs.lotterypost.com/speednet
naturehermit
Asp.Net User
Re: Counting Highlighted Characters in VS2005 Editor7/10/2007 2:19:01 PM

0/0

Sweet jeez Ps2, nice trick from your hat. Where can I learn about that..


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
ps2goat
Asp.Net User
Re: Counting Highlighted Characters in VS2005 Editor7/10/2007 2:40:29 PM

0/0

I learned it because I wanted to-- I had to clean up some code recently, and I knew I could extend the environment with macros.  One of the things I wanted to do in particular was remove the casing for parameters that were stored in the database.  That way, I could compare the parameter in the database to a version that was in all lower case, to prevent typing errors.  With over 50 parameters and adding, this would have been a bear, sense most parameters are camel-cased in the DB.  So I spent some time with macros to save me time in the future!

I looked a little bit into Visual Studio Extensibility using macros on the MSDN site (Main macro how-to page: http://msdn2.microsoft.com/en-us/library/8h31zbch(VS.80).aspx), and there were also a few samples in the IDE that made learning by example easy. 

For the samples, Open the Macro Explorer (View->Other Windows -> Macro Explorer), and there should be a module called 'Samples'.  You can view the code for these by right-clicking any of them and choosing 'Edit'.


---------------------------------------
MCP - Web Based Client Development .NET 2.0
naturehermit
Asp.Net User
Re: Counting Highlighted Characters in VS2005 Editor7/10/2007 2:46:19 PM

0/0

Thanks mate...


Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Coding Horror: Is Your IDE Hot or Not? While I am typing the background of the F# Interactive tool window is gray like the text editor. If I highlight the text the background of the highlighted ...
Problems with Visual Studio 2005 We’re using VS 2005 and TFS for source control in a Windows Forms solution counting 16 projects. It’s a nightmare! The IDE simply is so full of bugs that ...
Connect Bugs Fixed in Visual Studio 2005 Service Pack 1 Count causes crashes for Outlook add-in setup projects .... Icon Editor in Visual Studio 2005 does not save changes to existing icon file ...
CrystalEditor - WinMerge new syntax highlight rules; VS2005.net -style changebars; option for find and replace to not wrap end of file; support for showing EOL characters when ...
TheMSsForum.com >> MFC >> MFC dialog project under VS2005 ASSERTs ... I am trying to write a function that will "highlight" certain characters, ..... number of characters to read, not counting the > terminating null character. ...
sitemap | Visual Studio MSDN 0; Announcing the CTP for VSeWSS Version 1.1 0; Live Search @ SES San Jose 0; How Do I: Create a Basic Editor in Visual Studio 2005? ...
Understanding the Word Object Model from a Visual Studio 2005 ... It then uses the Range object's Select method to highlight the range. ...... Characters.Count; Word.Range rngDoc = this.Range(ref start, ref end); Word. ...
CodeProject: Creating and Using User Controls with .NET Framework ... As each ListView item is highlighted, an event is fired to any SelectItem ..... NET Framework 2.0 and Visual Studio 2005 C++/CLI, creating and using user ...
September 2006 - Posts - Derek Smyth's Software Development Blog A couple of points to highlight, the method ThisDocument.Range. ... I want to retrieve (using ADO) Excel worksheet name and total count of sheets. ...
Coding Horror: Copying Visual Studio Code Snippets to the ... Let's highlight the code execute the FormatToHtml.Modern macro, and then ..... I 'm running VS 2005 in a virtual machine and I have IE 7 on my host machine. ...




Search This Site:










problem to run aspx live for the first time

removing wizard step from wizard control

list of domain users and their roles

trying to contcatenate fixed-length strings

simple question...

iis authetication question

can't open project file

roles authorization?!

passing ampersand(&) in querystring

is this a bug in the menu control...?

lost passwords in 3.0.13 to 3.1.1 update

software that converts javascript to asp.net?

site always tries to install

need help with vertical solpartmenu css

need help saving file

asp.net 3.5?

check data from .txt, .doc files

dynamic height while using a masterpage

how to use office xp web component.

user control problem

question about screen scraping.

internet explorer cannot open the internet site http://...

web deployment project issue: how do i allow updates to various sections in web.config in the target server as part of installation ?

how do you use the security?

field contains html link to image

accessing a file on another server

tabstrip generates get /null 404 requests in iislog

themes

statement incorrect

does the dab close connections even with a datareader?

 
All Times Are GMT