.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

Formating Standard Subs in VS - VB.net (2005

I'm sure this is lunacy but I would like my subs (controls specifically) to be automatically formatted as below when I double click on a control on a form.

Private Sub tsbUpdate_Click(ByVal sender As System.Object, _
                            ByVal e As System.EventArgs) _
                            Handles tsmUpdate.Click, _
                                    tsbUpdate.Click
    Update()
End Sub

As opposed to the line to infinity that you get now.

Any thoughts?  Macro maybe?

TIA
Brad Siemens Send private email
Saturday, January 05, 2008
 
 
Sorry!  Formating didn't hold.  The idea is to line the params up below each other.

Thanks again.
Brad Siemens Send private email
Saturday, January 05, 2008
 
 
Not lunacy, but I don't know of an automatic option to do it.  You could write a macro to do it, looking for the commas, parens, etc.
Kyralessa Send private email
Saturday, January 05, 2008
 
 
Thanks.  That's sorta what I thought.

What does VS use to generate the sub formatting?  Maybe a template file of some description?


Bueller?
Anyone?

TIA
Brad Siemens Send private email
Saturday, January 05, 2008
 
 
I'd be interested in the answer to this too. Just formatting it the desired way once won't do. When editing VB files, VS2005 has a tendency to reformat whatever line the cursor is on according to its rules. That plays hell with version control when you're dealing with a codebase that wasn't originally built in VS2005.
clcr
Saturday, January 05, 2008
 
 
I don't know the answer, but do know that it is likely to be complicated. The "pretty printing" code in Visual Studio is directly related to the compiler itself somehow.

Paul Vick, one of the Program Managers for Visual Basic, wrote a couple of blog posts a while back, where he mentioned that he had to "bootleg the compiler" to make the pretty lister behave differently.

http://www.panopticoncentral.net/archive/2007/07/20/21212.aspx

http://www.panopticoncentral.net/archive/2007/08/10/21399.aspx
Raj Chaudhuri Send private email
Sunday, January 06, 2008
 
 
Thanks Raj!  I sent him a note so we may get some info.
Brad Siemens Send private email
Sunday, January 06, 2008
 
 
Sorry for the slow reply, I was out on vacation...

Right now, the pretty lister is not controllable -- the rules are built directly into the compiler and cannot be changed without changing the compiler itself. It's an interesting idea to allow the pretty lister to be more user-modifiable, but that'd be something for the future. It can't be done right now...

Thanks for using VB!
Paul
Paul Vick
Wednesday, January 23, 2008
 
 
Really appreciate the reply Paul, even though:-)

Thanks again!
Brad Siemens Send private email
Wednesday, January 30, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz