JDYoder Posted January 22, 2007 Posted January 22, 2007 In code, is there a way to reference the name of the sub or function you are in? When an error messages is shown (using ex.ToString) it lists the various subs, so it knows the names, so I'm wondering if that's accessible to Visual Studio 2005 VB.NET code as well. Example... Private Sub ProcessInvoices() End Sub In this sub, it is possible to refer to the name "ProcessInvoices"? (So if the sub name ever changes, then every place I refer to the sub name, it will automatically be the same?) Quote
IngisKahn Posted January 22, 2007 Posted January 22, 2007 new System.Diagnostics.StackFrame().GetMethod().Name Quote "Who is John Galt?"
JDYoder Posted January 24, 2007 Author Posted January 24, 2007 Thanks! That's exactly what I was looking for! :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.