Solved

create a breakpoint in VB.NET

Posted on 2004-08-11
22
1,449 Views
Last Modified: 2010-08-05
I tried to setup a breakpoint in my project, which I never have any problem in VB6, now it is a little out of hand.

There is a variable called 'schoolID', which I want to set the breakpoint when its value reaches '4431', so I highlight the word schoolID first, click debug from top menu, and select 'New Breakpoint', then I select the 'Data' tab, insert the letter 'schoolID' into variable area, hit the condition button, and type in '4431'.

When I hit the Ok button, I got 'Basic does not support data breakpoint'. I click the drop down box on 'Language', there lists BASIC
C#
C++
Jscript
Script
SQL
Unknown
VJ#

I did not see VB.NET(which I assume it should be one of the choice), is there anything wrong with the installation? Or is this a correct listing? It is such a simple thing to setup a debugger, anybody has any suggerstion? Thanks for your help!
0
Comment
Question by:cocoWang
  • 10
  • 4
  • 3
  • +4
22 Comments
 
LVL 14

Expert Comment

by:ptakja
Comment Utility
Apparently VB.Net doesn't support that.  I have VS .NET 2003 Enterprise Edition, and it gives me the same error despite the "Basic" language being listed.  Looks like an oversite to me.
0
 

Author Comment

by:cocoWang
Comment Utility
I have the VS.NET 2003 Enterprise Edition too, I wonder if this is a Microsoft software problem. Anybody knows about this ?
Please share with us.
0
 

Author Comment

by:cocoWang
Comment Utility
ptakja,

How do you setup the breakpoint in VB.NET environment for any variable?
0
 
LVL 25

Expert Comment

by:RonaldBiemans
Comment Utility
0
 
LVL 44

Expert Comment

by:Arthur_Wood
Comment Utility
That will be a capability in VS 2005 (If you have an MSDN subscription, you can download FREE the BETA release of VS 2005 - Code name "Whidbey")

AW
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Are you talking about a Watch condition?

Bob
0
 
LVL 14

Expert Comment

by:ptakja
Comment Utility
I just click in the left margin on the line that has that variable on it.  As TheLearnedOne commented, however, I think you are referring more to a watch condition than a breakpoint.
0
 

Author Comment

by:cocoWang
Comment Utility
ptakja,

I certainly can click the left margin of certain line, but that is not enough, I want to set up the value for some variable that I selected, and once that specific value of that variable is reached, it will stop there waiting for me to trace.
0
 

Author Comment

by:cocoWang
Comment Utility
Arthor Wood,

Do you mean that VS.NET 2003 does not support the setup of certain value for some variable to build a breakpoint? We have to wait for 2005 version?
0
 

Author Comment

by:cocoWang
Comment Utility
Sorry for wrong spelling your name .
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Were you on the Data tab for the Breakpoint dialog?

What you need is the Function tab when creating a new breakpoint.  Down towards the bottom is the <Condition...> button.  That has what you need.

Bob
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:cocoWang
Comment Utility
Yes, I selected the Data tab for breakpoint dialog. That is how I got 'Basic does not support data breakpoint' error message.

I have tried the function tab when creating a new breakpoint. But I also got different error message as below:

The following breakpoint cannot be set:
At Nobel_PRoject_2.DirectorySearch.ProcessFile(String)(DirectorySearch.vb, line 58), when 'filename=c:\msite\ar\site.211\ars_def.dbf' is true
End of expression expected.

Here is what I did:
1.  I inserted 'ProcessFile' into the Function section, leave 1 for Line: and 1 for Character, Basic for language.
2.  Click the condition button, insert 'c:\msite\ar\site.211\ars_def.dbf' for condition box, radio button is true is clicked.
3.  Click Ok button, and click OK button of the New Breakpoint dialog box.
 
I want the program stops when the filename(which is the parameter for ProcessFile function) reaches 'c:\msite\ar\site.211\ars_def.dbf', what I don't understand is what 'End of expression expected' is talking about? Where can I put the end of expression?

0
 

Author Comment

by:cocoWang
Comment Utility
Bob,

Please ignore those sigle quote I posted couple of minutes ago, I did not insert those single quote when creating the breakpoint, that post is just to show you what was inserted into those boxes.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
You posted this question a while ago (and it is still open!) : http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_21079468.html

The "Data tab" is only available when you do C++.

There is no way of breaking when a value changes with a scope other then a single line. But, instead of creating a variable, you could create a property (let-get) and place a breakpoint into the LET.
0
 

Author Comment

by:cocoWang
Comment Utility
emoreau,

No wonder I am lost, I am a VB programmer, can't figure out those beautiful (let-get) buzz word, any other suggestions ?
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
VB-Programmer should be used to let-get buzzword!

If you replace your variable declaration with this (supposing that your variable is named MyVariable and is a String)

    Dim _MyVariable As String

    Public Property MyVariable() As String
        Get
            Return _MyVariable
        End Get
        Set(ByVal Value As String)
            _MyVariable = Value
        End Set
    End Property

You can then place a breakpoint on the "_MyVariable = Value" line.
0
 

Author Comment

by:cocoWang
Comment Utility
You mean set-get, I thought you are talking let-get that probably exists in C++ when I first saw it. Sorry for the confusion!
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
>>You mean set-get, I thought you are talking let-get that probably exists in C++

Sorry. LET was used in the VB5/6 era in which I have been too long!
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Yeah, me too, still:(  Too much legacy code to maintain:)

Bob
0
 

Accepted Solution

by:
kimmel_b earned 50 total points
Comment Utility
How's this:
   Set the breakpoint by clicking the sidebar to the left of the line you want it to break on.
   Right-click the newly created breakpoint
   Go to Breakpoint Properties
   Click Condition...
   Enter schoolID = 4431 and click is true

Another method:
   At the place in the code where you want the break, put

          If schoolID = 4431 Then
                Stop
          End If
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
kimmel_b, the problem with your 2 methods is that the variable is only verified on one particular line of code. In VB6, we could easily monitor a variable in a scope (procedure, module, or application) and the execution stopped wherever the variable changed in that scope.

This feature does not exist as-is in VB.Net but using a property is THE workaround for now!
0
 

Author Comment

by:cocoWang
Comment Utility
I am going to send to support group asking them to give emoreau the credit. I did not know that I can't accept answers from two experts!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now