• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1548
  • Last Modified:

create a breakpoint in VB.NET

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
cocoWang
Asked:
cocoWang
  • 10
  • 4
  • 3
  • +4
1 Solution
 
ptakjaCommented:
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
 
cocoWangAuthor Commented:
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
 
cocoWangAuthor Commented:
ptakja,

How do you setup the breakpoint in VB.NET environment for any variable?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RonaldBiemansCommented:
0
 
Arthur_WoodCommented:
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
 
Bob LearnedCommented:
Are you talking about a Watch condition?

Bob
0
 
ptakjaCommented:
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
 
cocoWangAuthor Commented:
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
 
cocoWangAuthor Commented:
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
 
cocoWangAuthor Commented:
Sorry for wrong spelling your name .
0
 
Bob LearnedCommented:
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
 
cocoWangAuthor Commented:
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
 
cocoWangAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
cocoWangAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
cocoWangAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
>>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
 
Bob LearnedCommented:
Yeah, me too, still:(  Too much legacy code to maintain:)

Bob
0
 
kimmel_bCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
cocoWangAuthor Commented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 10
  • 4
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now