Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘Line’

“Unable to set the next statement to this location” error message when you are debugging a Visual Studio 2005 application

Symptoms
When you are debugging a Microsoft Visual Studio 2005 application and you try to set the next statement, you may receive an error message that resembles the following error message:

Unable to set the next statement to this location. There is no executable code at this location in the source code.
Resolution
The Debugger Engine is picking the statements in sequence. As long as the caret is at the end of the line, the Debugger Engine will set the next statement on the next line. If there is no executable code from the next line, an error message will occur.

INFO: VB 6.0 Readme Part 10: Extensibility Issues

Symptoms
The information below includes the documentation and workarounds for VisualBasic 6.0. This information can also be found in the README.htm file thatships with Visual Basic 6.0 on the Visual Basic 6.0 CD-ROM. Please see theREFERENCES section of this article for a list of the Microsoft KnowledgeBase articles relating to the Visual Basic 6.0 readme.
Following is a list of all parts of the readme file:

Part 1.Important Issues – Please Read First!Part 2.Data Access Issues and DataBinding TipsPart 3.Control IssuesPart 4.Language IssuesPart 5.Samples IssuesPart 6.Wizard IssuesPart 7.Error Message IssuesPart 8.WebClass Designer IssuesPart 9.DHTML Page Designer IssuesPart 10. Extensibility issuesPart 11. Miscellaneous IssuesPart 12. Microsoft Transaction Server (MTS) IssuesPart 13. Dictionary ObjectPart 14. Visual Component ManagerPart 15. Application Performance Manager
Resolution
“Command-Line Safe” Add-In BehaviorYou can use the Load Behavior box in the Add-In Manager to control how andwhen an add-in loads in Visual Basic:
Loaded/Unloaded — either loads or unloads a selected add-in when thebox is checked or unchecked.Load On Startup — indicates whether the selected add-in should loadwhen the Visual Basic IDE is started.Command Line — indicates whether an add-in should load when VisualBasic is started from a command line, either through a DOS prompt or ascript.When you select Command Line load behavior for an add-in, you may get thefollowing warning message:

“The selected add-in has not been confirmed to be ‘command-line safe’,and may require some user intervention (possible UI). Do you wish toproceed?”
This occurs when you select an add-in for Command Line load behavior thatwas not declared by the author of the add-in to be “command line safe” whenit was created. (This can be indicated with the Add-In Designer through acheckbox.)
“Command-line safe” means that the add-in is registered in a way toindicate that it contains no user interfaces that require user input whenVisual Basic is invoked through a command-line. A user interface caninterfere with the operation of unattended processes (such as buildscripts).
If you don’t indicate that an add-in is command-line safe (even if it iscommand-line safe), when a user selects your add-in and then Command Linein the Load Behavior box, they’ll receive the warning message. This isn’t aserious problem, but merely a warning to the user that the selected add-inmight possibly contain UI elements that can pop up unexpectedly and halttheir automated scripts by pausing for user input.
Manually Setting Add-In Registry ValuesYou can also manually set the command-line safe flag (as well as the othervalues) for an add-in through the Windows registry.
NOTE: You should not attempt to directly manipulate any Windows registryentries unless you are familiar with doing so. Setting an invalid registryentry can cause problems with Windows, even preventing you from being ableto load Windows.
In Visual Basic 6.0, the key that holds add-in information is located in:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Visual Basic\6.0\Addins\<add-in.name>.
For Visual Basic 6.0, the LoadBehavior DWord values are:
None = 0Startup = 1Command Line = 4Command Line / Startup = 5There is also an additional DWord value that indicates whether the add-inis command-line safe: CommandLineSafe. A value of 1 indicates the add-in iscommand-line safe, while a value of 0 (the default) indicates that it isnot command-line safe. A value of 0 is implied if you forget to check thecommand-line safe box in the Add-In Designer since the default value of 0is assumed, and the add-in isn’t considered command-line safe.
So, to demonstrate how to use these values to indicate that a fictitiousadd-in (My.Addin) is command-line safe and to have it load when VisualBasic is started by command-line, you would set the following registryvalues, using a tool such as RegEdit:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Visual Basic\6.0\Addins\My.Addin

“FriendlyName”=”A friendly name for your add-in”"Description”=”This value describes the add-in”"LoadBehavior”=dword:4″CommandLineSafe”=dword:1
Using the Add-In DesignerVisual Basic 6.0 includes a new tool, called the Add-In designer, to aidyou in creating add-ins. To open it:
Create a new add-in project.In the Project Explorer, under Designers, is a designer called Connect.Double-click it to activate the Add-In designer.Unfortunately, context-sensitive help currently isn’t available for the Add-In designer. Help topics are available, however. You can find theappropriate topics by searching for Add-In Designer in the MSDN index. Youshould see a list of three associated topics:
“Using the Add-In Designer”"General Tab (Add-In Designer)”"Advanced Tab (Add-In Designer)”For more information, search online, with Search titles only selected, for”Registering Add-Ins” in the MSDN Library Visual Studio 6.0 documentation.
Add-In Designer: More Information About Specifying Satellite DLLWhen creating an add-in with the Add-In designer, you can specify a DLL onthe Advanced tab. Be sure, however, to type only the name of the DLL file,and not its fully-qualified path. For example:
MyAddinName.DLL
not:
Addins\MyAddinName\MyAddinName.DLL
Localized Satellite DLLsIf you create a localized satellite DLL, you should also create a resourcesdirectory and a locale ID directory for the satellite DLL and install theDLL in the appropriate directory. The schematic for such a path is:
<AddIn Directory>\Resources\<Locale ID>\<MySatellite.DLL>
For example, a satellite DLL for the German version (Locale ID = 1031)would go into the directory:
C:\Program Files\MyAddin\Resources\1031\MyAddinName.DLL