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 ‘NET’

BUG: Error at run time after you upgrade a Microsoft Visual Basic 6.0 project that uses the ImageList control to Microsoft Visual Basic .NET

Symptoms
When you upgrade a Microsoft Visual Basic 6.0 project that uses the ImageList control to a Microsoft Visual Basic .NET project by using the Microsoft Visual Basic .NET Upgrade Wizard, you receive the following exception when you run the project in Visual Basic .NET:

An unhandled exception of type ‘System.Runtime.InteropServices.COMException’ occurred in axinterop.mscomctllib.dll
Resolution
The Visual Basic .NET Upgrade Wizard wraps the ImageList control in the AxHost class. However, it does not modify the corresponding Visual Basic 6.0 code to access the underlying ImageList control. For example, the following code may be part of the migrated Visual Basic .NET code.

ListView1.ColumnHeaderIcons = ImageList

“Differences Between Visual Basic .NET and Visual C# .NET” white paper is available

Symptoms
This article points to the “Differences Between Microsoft Visual Basic .NET and Microsoft Visual C# .NET” white paper.
Resolution
Because of the previous differences between Visual Basic and C/C++, many developers assume incorrectly about the capabilities of Visual Basic .NET. Many Visual Basic developers think that Visual C# is a more powerful language than Visual Basic. In other words, Visual Basic developers assume that you can do many things in Visual C# that you cannot do in Visual Basic .NET, just as there are many things that you can do in C/C++ but cannot do in Microsoft Visual Basic 6.0 or earlier. This assumption is incorrect.
Although there are differences between Visual Basic .NET and Visual C# .NET, both are first-class programming languages that are based on the Microsoft .NET Framework, and they are equally powerful. Visual Basic .NET is a true object-oriented programming language that includes new and improved features such as inheritance, polymorphism, interfaces, and overloading. Both Visual Basic .NET and Visual C# .NET use the common language runtime. There are almost no performance issues between Visual Basic .NET and Visual C# .NET. Visual C# .NET may have a few more “power” features such as handling unmanaged code, and Visual Basic .NET may be skewed a little toward ease of use by providing features such as late binding. However, the differences between Visual Basic .NET and Visual C# .NET are very small compared to what they were in earlier versions.
The “Differences Between Microsoft Visual Basic .NET and Microsoft Visual C# .NET” white paper describes some of the differences between Visual Basic .NET and Visual C# .NET. However, remember that the .NET Framework is intended to be language independent. When you must select between Visual Basic .NET and Visual C# .NET, decide primarily based on what you already know and what you are comfortable with. It is easier for Visual Basic 6.0 developers to use Visual Basic .NET and for C++/Java programmers to use Visual C# .NET. The existing experience of a programmer far outweighs the small differences between the two languages.
No matter which language you select based on your personal preference and past experience, both languages are powerful developer tools and first-class programming languages that share the common language runtime in the .NET Framework.
The following file is available for download from the Microsoft Download Center:

Collapse this imageExpand this image
Download the “Differences between Microsoft Visual Basic .NET and Microsoft Visual C# .NET” white paper package now.(http://download.microsoft.com/download/6/3/5/6354bf47-c597-4029-89e9-2495e7539ab9/vbcsharpwp.exe)Release Date: June 18, 2002
For more information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591?(http://support.microsoft.com/kb/119591/)How to obtain Microsoft support files from online servicesMicrosoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.

PRB: “Requested Registry Access Is Not Allowed” Error Message When ASP.NET Application Tries to Write New EventSource in the EventLog

Symptoms
When you use ASP.NET to create a new event source in the event log, you may receive the following error message:

System.Security.SecurityException: Requested registry access is not allowed.
Resolution
By default, the user token of the ASP.NET worker process is ASPNET (or NetworkService for applications that run on Internet Information Services [IIS] 6.0). The problem in the “Symptoms” section occurs because your account does not have the correct user rights to create an event source.

Output parameters are not returned when you run an ADO.NET command in Visual Basic

Symptoms
Output parameters do not appear to be initialized or return a wrong value when executing an ADO.NET command.
Resolution
This problem can occur for the following reasons: Output parameters are returned at the end of the data stream when using a DataReader object.The Direction property of the parameter is not set properly.

List of bugs that are fixed in Visual Studio .NET 2003 Service Pack 1

Symptoms
Microsoft Visual Studio .NET version 2003 Service Pack 1 (SP1) contains fixes for many bugs that have been documented in the Microsoft Knowledge Base (KB). This article lists these KB articles.
The list contains links to articles about Microsoft ASP.NET and Web Forms, Microsoft Visual Basic .NET, Microsoft Visual C# .NET, Microsoft Visual C++ .NET, Microsoft Visual J# .NET, Microsoft Visual Studio .NET, and Microsoft Visual Studio for Devices.
Resolution
This article contains a list of Microsoft Knowledge Base (KB) articles that describe bugs that are fixed in Microsoft Visual Studio .NET 2003 SP1.
To obtain Visual Studio .NET 2003 SP1, visit the following Microsoft Download Center Web site:
http://www.microsoft.com/downloads/details.aspx?familyid=69d2219f-ce82-46a5-8aec-072bd4bb955e(http://www.microsoft.com/downloads/details.aspx?familyid=69d2219f-ce82-46a5-8aec-072bd4bb955e)To see a complete list of updates for Visual Studio .NET products and for Microsoft .NET Framework products, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/vstudio/aa718693.aspx(http://msdn2.microsoft.com/en-us/vstudio/aa718693.aspx)

Keywords to search .NET-related Knowledge Base articles

Symptoms
The Microsoft Knowledge Base is categorized by keywords. The keywords help to refine the search criteria. This article lists the keywords that are used as metadata for .NET related Knowledge Base articles. The following .NET-related areas are included in this article: ADO.NETASP.NETAssembliesBCL (Base Class Libraries)C#C++COM InteropCommon Language RuntimeDebuggingDeploymentEnterprise ServicesGDI+LocalizationMobile Controls.NET ClassesP-Invoke (Platform Invoke)RemotingSecurityVisual Basic .NETVisual Studio .NETWindows FormsWeb Services
Resolution
Each Knowledge Base article may contain one or more product-specific keywords (named KBKeyword) that put the article in the appropriate category. Some of the Knowledge Base keywords are composed of the resulting concatenation of keywords. For example, you can find all the ASP.NET and Data Binding issue articles by using the kbASPNET kbDataBinding keyword combination in your search criteria. The following tables list the topics that are related to .NET in the Knowledge Base, including a link to the related support centers (where available) where you can browse the Microsoft Knowledge base by topic, and the corresponding Knowledge Base keywords:ADO.NETADO.NET Support Center(http://support.microsoft.com/ph/548)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All ADO.NET related articles| kbADONET|+———————————-+——————————————+| Connection Pooling| kbADONET kbConnectionPooling|+———————————-+——————————————+| DataBinding| kbADONET kbDataBinding|+———————————-+——————————————+| DataSet issues| kbADONET kbSystemData kbDataSet|+———————————-+——————————————+| EvaluateExpression issue| kbADONET kbSystemData|+———————————-+——————————————+| Interop with native ADO| kbADONET kbInterop kbADO|+———————————-+——————————————+| OleDb issues| kbADONET kbOleDb|+———————————-+——————————————+| Oracle| kbADONET kbOracle|+———————————-+——————————————+| Performance| kbADONET kbPerformance|+———————————-+——————————————+| SqlClient issues| kbADONET kbSqlClient|+———————————-+——————————————+| SqlDataAdapter issues| kbADONET kbSystemData kbSqlClient||| kbSqlDataAdapter|+—————————————————————————–+ASP.NETASP.NET Support Center(http://support.microsoft.com/ph/1249)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All ASP.NET related articles| kbASPNET|+———————————-+——————————————+| All ASP.NET Enterprise Services| kbASPNET kbEntServices|| articles||+———————————-+——————————————+| All ASP.NET Data access related| kbASPNET kbADONET|| articles||+———————————-+——————————————+| Caching| kbASPNET kbCaching|+———————————-+——————————————+| Configuration| kbASPNET kbConfig|+———————————-+——————————————+| Connectivity| kbASPNET kbConnectivity|+———————————-+——————————————+| Cookieless Sessions| kbState kbCookie|+———————————-+——————————————+| DataBinding| kbASPNET kbDataBinding|+———————————-+——————————————+| Debugging| kbASPNET kbDebug|+———————————-+——————————————+| Deployment| kbASPNET kbDeployment|+———————————-+——————————————+| HttpRuntime| kbASPNET kbHttpRuntime|+———————————-+——————————————+| Migration| kbASPNET kbMigration|+———————————-+——————————————+| Navigation| kbASPNET kbNavigation|+———————————-+——————————————+| Page/Web Form| kbWebForms|+———————————-+——————————————+| Server Controls| kbASPNET kbServerControls|+———————————-+——————————————+| State Management| kbASPNET kbState|+———————————-+——————————————+| Validation| kbASPNET kbValidation|+———————————-+——————————————+| Web Form| kbASPNET kbWebForm|+—————————————————————————–+Assemblies.NET Framework Support Center(http://support.microsoft.com/netframe11)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All Assemblies related articles| kbAssemblies|+—————————————————————————–+BCL (Base Class Libraries)Class Libraries in the .NET Framework Support Center (http://support.microsoft.com/netframe11?sid=128)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All Base Class Library related| kbBCL|| articles||+—————————————————————————–+C#Visual C# .NET Supoprt Center(http://support.microsoft.com/ph/3040)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| Compiler related issues| kbCompiler|+———————————-+——————————————+| Language related issues| kbLangC|+———————————-+——————————————+| Documentation/Samples| kbDoc or kbSample|+———————————-+——————————————+| Project/Build System| kbBuilder|+—————————————————————————–+C++Visual C++ .NET Supoprt Center(http://support.microsoft.com/vcnet)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| ATL| kbATL|+———————————-+——————————————+| ATL Server| kbATLServer|+———————————-+——————————————+| Attributes| kbNativeAttributes|+———————————-+——————————————+| Compiler| kbCompiler|+———————————-+——————————————+| CRT| kbCRT|+———————————-+——————————————+| Designers| kbDesigner|+———————————-+——————————————+| Documentation/Samples| kbDocs or kbSample|+———————————-+——————————————+| Linker| kbLinker|+———————————-+——————————————+| MFC| kbMFC|+———————————-+——————————————+| Project/Build System| kbBuilder|+———————————-+——————————————+| STL| kbSTL|+—————————————————————————–+COM InteropCommon Language Runtime in the .NET Framework Support Center (http://support.microsoft.com/netframe11?sid=122)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All COM Interop related articles | kbCOMInterop|+———————————-+——————————————+| Data Marshaling| kbCOMInterop kbMarshal|+———————————-+——————————————+| Events| kbCOMInterop kbEvent|+———————————-+——————————————+| Threading| kbCOMInterop kbThread|+—————————————————————————–+Common Language RuntimeCommon Language Runtime in the .NET Framework Support Center(http://support.microsoft.com/netframe11?sid=122)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All common language runtime| kbCLR|| related articles||+———————————-+——————————————+| Component Model| kbCLR kbCompModel|+———————————-+——————————————+| Garbage Collector| kbCLR kbGarbageCollect|+———————————-+——————————————+| JIT Compiler/IL| kbCLR kbJIT|+———————————-+——————————————+| Profiling| kbCLR kbPerformanceTool|+—————————————————————————–+DebuggingDebugging in the .NET Framework Support Center(http://support.microsoft.com/netframe11?sid=262)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All Debugging related articles| kbDebug|+———————————-+——————————————+| common language runtime| kbDebug kbCLR|+———————————-+——————————————+| Configuration| kbDebug kbConfig|+———————————-+——————————————+| Mixed (Native/Managed)| kbDebug kbNativeAttributes kbManaged|+———————————-+——————————————+| Native| kbDebug kbNativeAttributes|+———————————-+——————————————+| Remote| kbDebug kbRemoteProg|+———————————-+——————————————+| Script| kbDebug kbScript|+———————————-+——————————————+| T-SQL| kbDebug kbTSQL|+—————————————————————————–+Deployment.NET Framework Support Center(http://support.microsoft.com/netframe11)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All Deployment related articles| kbDeployment|+—————————————————————————–+Enterprise ServicesEnterprise Services in the .NET Framework Support Center(http://support.microsoft.com/netframe11?sid=115)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All Enterprise Services related| kbEntServices|| articles||+—————————————————————————–+GDI+.NET Framework Support Center(http://support.microsoft.com/netframe11)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All Drawing related articles| kbDrawing|+———————————-+——————————————+| Design| kbDrawing kbDesign|+———————————-+——————————————+| Imaging| kbDrawing kbgdiimaging|+———————————-+——————————————+| Metafiles| kbDrawing kbMetafile|+———————————-+——————————————+| Performance| kbDrawing kbPerformance|+———————————-+——————————————+| Printing| kbDrawing kbPrint|+———————————-+——————————————+| Text/Fonts| kbDrawing kbgditext or kbDrawing kbFont|+———————————-+——————————————+| Transforms/Coordinate Spaces| kbDrawing kbgdiptransform|+———————————-+——————————————+| Vector Graphics| kbDrawing kbgdivector|+—————————————————————————–+Localization

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All Localization related| kbLocalization|| articles||+—————————————————————————–+Mobile Controls.NET Framework Support Center(http://support.microsoft.com/netframe11)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All Mobile Controls related| kbCtrl|| articles||+—————————————————————————–+.NET Classes.NET Framework Support Center(http://support.microsoft.com/netframe11)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All .NET Class related articles| kbNETClasses|+—————————————————————————–+P-Invoke (Platform Invoke).NET Framework Support Center(http://support.microsoft.com/netframe11)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All P-Invoke related articles| kbPInvoke|+—————————————————————————–+RemotingRemoting in the .NET Framework Web Services Support Center(http://support.microsoft.com/netframe11?sid=100)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All Remoting related articles| kbRemoting|+———————————-+——————————————+| Channels| kbRemoting kbChannels|+———————————-+——————————————+| HTTP| kbRemoting kbHttp|+———————————-+——————————————+| TCP| kbRemoting kbTunneling|+———————————-+——————————————+| Connectivity| kbRemoting kbConnectivity|+———————————-+——————————————+| Delegates/Events| kbRemoting kbEvent|+—————————————————————————–+SecuritySecurity in the .NET Framework Support Center(http://support.microsoft.com/netframe11?sid=200)

+—————————————————————————–+|FOCUS|KEYWORD|+———————————-+——————————————+| All Security related articles| kbSecurity|+—————————————————————————–+Visual Basic .NETVisual Basic .NET Support Center(http://support.microsoft.com/vbnet2003)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All Visual Basic .NET related| kbVBNET|| articles||+———————————-+——————————————+| Compiler| kbVBNET kbCompiler|+———————————-+——————————————+| Documentation Bugs| kbVBNET kbDocumentation|+———————————-+——————————————+| Migration| kbVBNET kbMigration|+———————————-+——————————————+| Performance| kbVBNET kbPerformance|| (language, not related to IDE)||+———————————-+——————————————+| Samples| kbVBNET kbSamples|+———————————-+——————————————+| Language (including inheritance, | kbVBNET kbLanguage|| syntax, and others)||+—————————————————————————–+Visual Studio .NETVisual Studio .NET Support Center(http://support.microsoft.com/vsnet2003)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All Visual Studio .NET related| kbVSSearch|| articles||+———————————-+——————————————+| Admin| kbVSSearch kbAdmin|+———————————-+——————————————+| Deployment| kbVSSearch kbDeployment|+———————————-+——————————————+| Performance|kbVSSearch kbPerformance|| (IDE including project/build)||+———————————-+——————————————+| Project (including build,| kbVSSearch kbProject|| References, and others)||+———————————-+——————————————+| IDE| kbVSSearch kbIDE|| (such as windows and wizards)||+———————————-+——————————————+| Documentation Bugs| kbVSSearch kbDocumentation|+———————————-+——————————————+| Setup Specific| kbVSSearch kbSetup|+———————————-+——————————————+| Setup Bug| kbVSSearch kbSetup kbBug|+—————————————————————————–+Windows FormsWindows Forms Support Center(http://support.microsoft.com/netframe11?sid=133)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All Windows Forms related| kbWindowsForms|| articles||+———————————-+——————————————+| Controls| kbWindowsForms kbCtrl|+———————————-+——————————————+| Designer| kbWindowsForms kbDesigner|+———————————-+——————————————+| Events| kbWindowsForms kbEvent|+———————————-+——————————————+| Forms| kbWindowsForms kbForms|+———————————-+——————————————+| MDI| kbWindowsForms kbForms kbMDI|+———————————-+——————————————+| Menus| kbWindowsForms kbForms kbMenu|+—————————————————————————–+Web Services.NET Framework Support Center(http://support.microsoft.com/netframe11)

+—————————————————————————–+|FOCUS|KEYWORD COMBINATIONS|+———————————-+——————————————+| All Web Service related articles | kbNetFrameWebServ|+———————————-+——————————————+| Client Proxies| kbNetFrameWebServ kbClient|+———————————-+——————————————+| Discovery| kbNetFrameWebServ kbDiscovery|+—————————————————————————–+