473,382 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Program Name and Line Number

Using vb.net - how can I find the current program name and line number as I
am running through the code without there being an error.


Jul 21 '05 #1
2 1706
> Using vb.net - how can I find the current program name and line number as
I
am running through the code without there being an error.


Take a look at the "System.Diagnostics.StackFrame" class. It should give
you what you're looking for so long as you're running in "debug" mode.

--
Thanks, Jeff
Jul 21 '05 #2
Here you go... This is C#, but it translates very easy:

StackTrace stackTrace = new StackTrace(Thread.CurrentThread, true);

StackFrame frame = stackTrace.GetFrame(0);

Console.WriteLine("File Name: {0}, Line Number: {1}",

frame.GetFileName(), frame.GetFileLineNumber());

Regards,

Bennie Haelen

"Alex Campos" <ac*****@invalid.pcgh.com> wrote in message
news:OM**************@tk2msftngp13.phx.gbl...
Using vb.net - how can I find the current program name and line number as I am running through the code without there being an error.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mahmood Ahmad | last post by:
Hello, I have written a program that reads three types of records, validates them acording to certain requirements and writes the valid records into a binary file. The invalid records are...
7
by: jmac | last post by:
Greetings fellow programmers, I have created a C program that has a few bugs and would like to get some help with working them out. Here is a list of the problems that I am experiencing: -...
3
by: Shark1 | last post by:
Hello. I'm suppose to write a program that will match the price given by the user using the least number of coins. There are 5 different type of coins. I get this output, the count is...
10
by: mwt | last post by:
So in a further attempt to learn some Python, I've taken the little Library program (http://groups.google.com/group/comp.lang.python/browse_thread/thread/f6a9ccf1bc136f84) I wrote and added...
39
by: Ravi | last post by:
Can you all please suggest a program which tell us the range of memry addresses occupied by the given c program?
6
by: aureao4 | last post by:
I'm new to Java and programming. I'm trying to code a payroll program and continue getting errors. The program worked last week, this week I have to add set, get and a class. I've written the class...
3
trkrbabe
by: trkrbabe | last post by:
Hi, this is my first time posting here. It appears that I am taking the same class as a few other people here. I have only been learning Java for about five weeks now. I have my Product class...
11
by: hamiltongreg | last post by:
I am new to Java and am having problems getting my program to compile correctly. My assignment is as follows; Choose a product that lends itself to an inventory (for example, products at your...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
0
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.