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 ‘microsoft transaction server’

INFO: VB 6.0 Readme Part 14: Visual Component Manager

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
Known Problems in Visual Component Manager:
Related Files Tab (Component Properties Dialog Box)” Topic IncorrectVisual Component Manager User Interface Reference: The topic “Related FilesTab (Component Properties Dialog Box)” incorrectly states that the tab isused to display and enter files that are related to the selected component.In fact, none of the information displayed on this tab can be modified. Youcan add related files to a component only when publishing or re-publishingthe component. For more information, search online, with Search titles onlyselected, for “Publishing Components” in the MSDN Library Visual Studio 6.0documentation.
Removing Repository 1.0 Registry KeysIf you installed VCM 5.0 (previously available for Web download) you willhave the following Windows Registry keys setup. They were necessary for VCM5.0 and the 1.0 version of the Repository. If you find the followingRegistry entries then it is safe to remove them and may, in fact, improveVCM 6.0 performance:
HKEY_LOCAL_MACHINE\Software\Microsoft\Repository\CacheMaxAnnPropsHKEY_LOCAL_MACHINE\Software\Microsoft\Repository\CacheMaxObjectsHKEY_LOCAL_MACHINE\Software\Microsoft\Repository\CacheRelshipMaxCollectionsHKEY_LOCAL_MACHINE\Software\Microsoft\Repository\CacheRelshipMaxRowsHKEY_LOCAL_MACHINE\Software\Microsoft\Repository\MaxRowCacheAge
Adding Repository Tables to an Existing .mdb FileIf you try to open an existing .mdb file from within VCM that is not arepository database (i.e., it does not contain the repositorystructure/tables), you will be asked if you want the repository tablesadded to the database. You should not do this for normal use; therepository should generally be in a separate database. This will work, butit can take as long as 10 minutes to create the repository structure in anexisting .mdb file.
To create a brand new .mdb file containing the repository structure, right-click in the folder outline, click Repository, click New, and then enterthe name of the file you want to create.

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

INFO: VB 6.0 Readme Part 1: Important Issues – Read First!

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 Tips
Part 3.Control Issues
Part 4.Language Issues
Part 5.Samples Issues
Part 6.Wizard Issues
Part 7.Error Message Issues
Part 8.WebClass Designer Issues
Part 9.DHTML Page Designer Issues
Part 10. Extensibility issues
Part 11. Miscellaneous Issues
Part 12. Microsoft Transaction Server (MTS) Issues
Part 13. Dictionary Object
Part 14. Visual Component Manager
Part 15. Application Performance Manager
Resolution
Passing User-Defined Types to ProceduresWith Visual Basic 6.0 it is possible to pass a user defined type (UDT) asan argument to a procedure or function. However, there is a restriction.Passing a UDT to a procedure in an out-of-process component or acrossthreads in a multi-threaded component requires an updated version of DCOMfor Windows 95 and Windows 98, or Service Pack 4 for Windows NT 4.0. Thisupdate is required on your development computer as well as on any computerthat will run your application. A run-time error will occur if the requiredfiles are not installed.
The above does not apply to passing UDTs within a single-threadedapplication; this will work without updating. The Package and DeploymentWizard will not determine the dependencies for the necessary components -it is up to you to make sure that the files are on the end user’s computer.You can test for the existence of the components by trapping for run-timeerror 458 – “Variable uses an Automation type not supported in VisualBasic”. If this error occurs, the DCOM or Service Pack components must beupdated; the update procedure differs depending on the operating system:
Windows 95 or Windows 98
DCOM98.EXE is a self-extracting executable that installs the updatedDCOM components for Windows 95 or Windows 98. It can be found in theDCOM98 directory of the Visual Basic 6.0 CD. This file may be freelydistributed with your Visual Basic application.Windows NT 4.0
The updated DCOM components are automatically installed with ServicePack 4 (SP4). When it is released, you can download the Service Packfrom the Microsoft Web site.
Searching Online by Topic TitleTo search for a topic when you have the title:
In the navigation pane of the MSDN window, click the Search tab and thentype or paste the title of the topic you want to find. Enclose thesearch string in quotation marks.Click Search Titles Only.Click List Topics. (If your search returns more than one hit, you cansort the topic list by clicking the Title or Location column heading.)Select the title of the topic you want and then click Display.
To find where a topic is located in the table of contents, click theLocate button on the toolbar. The table of contents will synchronizewith the topic you are viewing.
NOTE: The Locate button is unavailable for the topics in the Referencenode of the Visual Basic documentation.Cross References to Internet Client SDK
Refer to the Internet/Intranet/Extranet SDKIn the Building Internet Applications book within the Component ToolsGuide, multiple cross references are made to a part of MSDN referred to asthe “Internet Client SDK.” The correct name for this SDK is the”Internet/Intranet/Extranet SDK.” When searching for an Internet Client SDKreference in MSDN, please look in this section.
Context-Sensitive HelpTo use Help buttons and the F1 key to access Help without having the MSDNCD in your CD drive, you must choose the Custom install option during setupof the MSDN Library. Check the boxes labeled “VB Documentation,” “VBProduct Samples,” and “VS Shared Documentation.” You may also want to check”VSS Documentation” if you are using Visual SourceSafe.
Sample Code Sometimes Does Not Cut and Paste ProperlyLine breaks and formatting information may not copy correctly when you copyand paste sample code from the MSDN Library Visual Studio documentation toyour code editor. To work around this issue, do one of the following:
Manually edit the line breaks after you copy the code.View the sample code source, copy the entire code sample, including the<pre> and </pre> tags, paste it to your code editor, and then delete theunwanted sections from the pasted version.
Locate Button Disabled for Reference TopicsWhen you find a language reference topic in MSDN through the Search tab,you cannot use the Locate button to find where the topic is located in theMSDN Table of Contents tree.

FIX: Source and Description Blank when Using Err.Raise from MTS and ASP

Symptoms
When raising an error inside a Visual Basic component in a Microsoft Transaction Server (MTS) Server Package that is called from another Visual Basic component in a different MTS Server Package, ASP displays only the error number. The error source and description fields are empty.
Resolution
Make sure that all the object references are set to Nothing before raising the error (particularly for the object that holds the reference to the ObjectContext.CreateInstance of the first component).