Re: 2005 too smart for it's own good?
- From: cj <cj@xxxxxxxxxxxxx>
- Date: Wed, 20 Sep 2006 09:54:48 -0400
Linda Liu [MSFT] wrote:
Hi Cj,
for x = 1 to 3up.
messagebox.show(x)
next
when for x = 1 to 3 is highlighted and I press F11 the message box pops
If we set a break point at the line of code 'for x = 1 to 3' and press F5 to run this program, the program enters break mode when this line of code is executed. At this time, this line of code is highlighted. If we press F11 to step into, the line of code 'messagebox.show(x)' is highlighted and a message box pops up.
Do you mean you have seen something different from the above?
Yes. Though I have to be honest I' not actually using messagebox.show(x). I wanted to made a simple example but it turns out the example works as it should.
This is the actual code that does not work.
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
' Start Excel and get Application object.
oXL = CreateObject("Excel.Application")
oXL.Visible = True
oWB = oXL.Workbooks.Add
For x As Int32 = oWB.Sheets.Count To 2 Step -1
oWB.Worksheets(x).delete()
Next
This is what I'm doing. Set the breakpoint on the line "oXL.Visible = True". The program goes into debug mode when it gets to that line but BEFORE it executes that line. press F11--Excel becomes visible on the task bar and "oWB = oXL.Workbooks.Add" becomes yellow. press F11--The workbook is created in Excel and "For x As Int32 = oWB.Sheets.Count To 2 Step -1" becomes yellow. Good so far. Press F11--The Excel icon on the task bar starts flashing and "oWB.Worksheets(x).delete()" becomes yellow. If click Excel on the taskbar you will note it's saying "the sheet will be permanently deleted ok cancel". That's the problem. VB should not have told Excel to delete the sheet yet. That line is yellow waiting for me to press F11 to run--it has not been run yet.
Normally when I press F11 on a yellow line it is executed and the next line of code is turned yellow. In this case when "For x As Int32 = oWB.Sheets.Count To 2 Step -1" was yellow and I pressed F11 "For x As Int32 = oWB.Sheets.Count To 2 Step -1" was executed AND "oWB.Worksheets(x).delete()" was executed! "oWB.Worksheets(x).delete()" was left yellow as it should be but it had already been executed.
I renamed the directory test to oldtest. I started VB.NET 2005 and toldit to create a new project called test.
Which directory did you rename, the solution directory or the project directory?
Solution directory? Project directory?
I renamed C:\Documents and Settings\cj\My Documents\Visual Studio 2005\Projects\test to C:\Documents and Settings\cj\My Documents\Visual Studio 2005\Projects\oldtest And I assure you it was renamed.
I don't know what it is but I also found and deleted C:\Documents and Settings\cj\My Documents\Visual Studio 2005\Backup Files\test
I didn't find any other directories called test so I assume that is where the VB2005 saves the programs. In VB2003 I would have renamed C:\Documents and Settings\cj\My Documents\Visual Studio Projects\test to C:\Documents and Settings\cj\My Documents\Visual Studio Projects\oldtest
Did you create a new project calle test with a new solution or
within the previous solution?
I had VB2005 closed when the directory was renamed. I started VB2005 and on the start page I clicked on project just to the left of create. I then changed the name from windowsapplication1 to test and clicked OK.
If finally got these steps to work but I had to reboot my computer before they did.
I look forward to your reply.
Thanks!
.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- Re: 2005 too smart for it's own good?
- From: Michael D. Ober
- Re: 2005 too smart for it's own good?
- From: Linda Liu [MSFT]
- Re: 2005 too smart for it's own good?
- References:
- 2005 too smart for it's own good?
- From: cj
- RE: 2005 too smart for it's own good?
- From: Linda Liu [MSFT]
- 2005 too smart for it's own good?
- Prev by Date: Passing data from one VB.Net application to another
- Next by Date: shrinking images isometric
- Previous by thread: RE: 2005 too smart for it's own good?
- Next by thread: Re: 2005 too smart for it's own good?
- Index(es):
Relevant Pages
|