Solved

create a breakpoint in VB.NET

Posted on 2004-08-11
22
1,495 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 4
  • 3
  • +4
22 Comments
 
LVL 14

Expert Comment

by:ptakja
ID: 11774635
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
ID: 11774759
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
ID: 11774948
ptakja,

How do you setup the breakpoint in VB.NET environment for any variable?
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11775107
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 11775259
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
ID: 11775360
Are you talking about a Watch condition?

Bob
0
 
LVL 14

Expert Comment

by:ptakja
ID: 11775743
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
ID: 11776164
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
ID: 11776181
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
ID: 11776193
Sorry for wrong spelling your name .
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11776227
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
 

Author Comment

by:cocoWang
ID: 11776548
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
ID: 11776630
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 70

Expert Comment

by:Éric Moreau
ID: 11777033
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
ID: 11777526
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 70

Expert Comment

by:Éric Moreau
ID: 11777587
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
ID: 11777663
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 70

Expert Comment

by:Éric Moreau
ID: 11777991
>>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
ID: 11778112
Yeah, me too, still:(  Too much legacy code to maintain:)

Bob
0
 

Accepted Solution

by:
kimmel_b earned 50 total points
ID: 11783571
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 70

Expert Comment

by:Éric Moreau
ID: 11783708
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
ID: 11784064
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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