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 ‘knowledge base article’

How To Pass String Data Between Applications Using SendMessage

Symptoms
There are many ways to achieve inter-process communication using VisualBasic. Unless you establish an OLE Automation client server relationship,string data is difficult to handle cleanly. The main reason is that 32-bitapplications run in a separate address space, so the address of a string inone application is not meaningful to another application in a differentaddress space. Using the SendMessage() API function to pass a WM_COPYDATAmessage avoids this problem.
This article demonstrates how to pass string data from one application toanother by using the SendMessage API function with the WM_COPYDATA message.
Resolution
WARNING: One or more of the following functions are discussed in this article; VarPtr, VarPtrArray, VarPtrStringArray, StrPtr, ObjPtr. These functions are not supported by Microsoft Technical Support. They are not documented in the Visual Basic documentation and are provided in this Knowledge Base article “as is.” Microsoft does not guarantee that they will be available in future releases of Visual Basic.
Visual Basic does not support pointers and castings in the manner of VisualC++. In order to pass string data from one Visual Basic application toanother, the Unicode string must be converted to ASCII prior to passing itto the other application. The other application must then convert the ASCIIstring back to Unicode.
The following summarizes how to pass string data from one application toanother.
Step-by-Step Example Convert the string to a byte array using the CopyMemory() API.Obtain the address of the byte array using the VarPtr() intrinsicfunction and copy the address and length of the byte array into a COPYDATASTRUCT structure.Pass the COPYDATASTRUCT to another application using the WM_COPYDATAmessage, setting up the other application to receive the message.Unpack the structure on the target system using CopyMemory(), andconvert the byte array back to a string using the StrConv() intrinsicfunction.The next section shows you how to create a sample program that demonstratespassing string data from one application to another.
Steps to Create the SampleTo create this sample, you create two separate projects; a sendingproject and a target project.
Create the target application:Start a new Standard EXE project in Visual Basic. Form1 is created by default. This project will be your target application.Add a Label control to Form1.Copy the following code to the Code window of Form1:

Private Sub Form_Load()gHW = Me.hWndHookMe.Caption = “Target”Me.ShowLabel1.Caption = Hex$(gHW)End SubPrivate Sub Form_Unload(Cancel As Integer)UnhookEnd Sub Add a module to the project and paste the following code in the Module1 code window:

Type COPYDATASTRUCTdwData As LongcbData As LonglpData As LongEnd TypePublic Const GWL_WNDPROC = (-4)Public Const WM_COPYDATA = &H4AGlobal lpPrevWndProc As LongGlobal gHW As Long’Copies a block of memory from one location to another.Declare Sub CopyMemory Lib “kernel32″ Alias “RtlMoveMemory” _(hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)Declare Function CallWindowProc Lib “user32″ Alias _”CallWindowProcA” (ByVal lpPrevWndFunc As Long, ByVal hwnd As _Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As _Long) As LongDeclare Function SetWindowLong Lib “user32″ Alias “SetWindowLongA” _(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As _Long) As LongPublic Sub Hook()lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _AddressOf WindowProc)Debug.Print lpPrevWndProcEnd SubPublic Sub Unhook()Dim temp As Longtemp = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)End SubFunction WindowProc(ByVal hw As Long, ByVal uMsg As Long, _ByVal wParam As Long, ByVal lParam As Long) As LongIf uMsg = WM_COPYDATA ThenCall mySub(lParam)End IfWindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, _lParam)End FunctionSub mySub(lParam As Long)Dim cds As COPYDATASTRUCTDim buf(1 To 255) As ByteCall CopyMemory(cds, ByVal lParam, Len(cds))Select Case cds.dwDataCase 1Debug.Print “got a 1″Case 2Debug.Print “got a 2″Case 3Call CopyMemory(buf(1), ByVal cds.lpData, cds.cbData)a$ = StrConv(buf, vbUnicode)a$ = Left$(a$, InStr(1, a$, Chr$(0)) – 1)Form1.Print a$End SelectEnd Sub Save the project and minimize the Visual Basic IDE.
Create the Sending ApplicationStart a second instance of the Visual Basic IDE and create a new Standard EXE project in Visual Basic. Form1 is created by default.Add a CommandButton to Form1.Copy the following code to the Code window of Form1:

Private Type COPYDATASTRUCTdwData As LongcbData As LonglpData As LongEnd TypePrivate Const WM_COPYDATA = &H4APrivate Declare Function FindWindow Lib “user32″ Alias _”FindWindowA” (ByVal lpClassName As String, ByVal lpWindowName _As String) As LongPrivate Declare Function SendMessage Lib “user32″ Alias _”SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, ByVal _wParam As Long, lParam As Any) As Long’Copies a block of memory from one location to another.Private Declare Sub CopyMemory Lib “kernel32″ Alias “RtlMoveMemory” _(hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)Private Sub Command1_Click()Dim cds As COPYDATASTRUCTDim ThWnd As LongDim buf(1 To 255) As Byte’ Get the hWnd of the target applicationThWnd = FindWindow(vbNullString, “Target”)a$ = “It Works!”‘ Copy the string into a byte array, converting it to ASCIICall CopyMemory(buf(1), ByVal a$, Len(a$))cds.dwData = 3cds.cbData = Len(a$) + 1cds.lpData = VarPtr(buf(1))i = SendMessage(ThWnd, WM_COPYDATA, Me.hwnd, cds)End SubPrivate Sub Form_Load()’ This gives you visibility that the target app is running’ and you are pointing to the correct hWndMe.Caption = Hex$(FindWindow(vbNullString, “Target”))End Sub Save the project.
Running the SampleRestore the target application and press the F5 key to run the project. Note that the value of the hWnd displayed in the label.Restore the sending application and press the F5 key to run the project.Verify that the hWnd in the form caption matches the hWnd in the labelon the target application. Click the CommandButton and the text messageshould be displayed on the form of the target application.

ASP.NET data binding overview

Symptoms
This article provides an introduction to ASP.NET data binding.
For additional ASP.NET overviews, see the following Microsoft Knowledge Base article:
305140?(http://support.microsoft.com/kb/305140/) ASP.NET roadmap
Resolution
With ASP.NET data binding, you can bind any server control to simple properties, collections, expressions and/or methods. When you use data binding, you have more flexibility when you use data from a database or other means.
This article addresses the following data binding topics: Data binding essentials<%# %> SyntaxPage.DataBind() versus Control.DataBind()Data-bound list controlsRepeater controlDataList controlDataGrid controlAccessing dataDataSet dlassDataReader dlassBinding in list control templatesDataBinder.Eval methodExplicit castingItemDataBound event
Data binding essentials<%# %> Syntax ASP.NET introduces a new declarative syntax, <%# %>. This syntax is the basis for using data binding in an .aspx page. All data binding expressions must be contained within these characters. The following list includes examples of simple data binding from multiple sources: Simple property (syntax for a customer):

<%# custID %> Collection (syntax for an order):

<asp:ListBox id=”List1″ datasource=’<%# myArray %>’ runat=”server”> Expression (syntax for a contact):

<%# ( customer.First Name + ” ” + customer.LastName ) %> Method result (syntax for the outstanding balance):

<%# GetBalance(custID) %> In the preceding examples, the inline <%# %> tags indicate where the information from a specific data source is to be placed in the .aspx page. The following data binding example uses a TextBox Web server control:

<asp:textbox id=txt text=”<%# custID %>” runat=server /> For more information about data binding syntax, see the following .NET Framework Software Development Kit (SDK) documentation:
Data Binding Expression Syntax
http://msdn2.microsoft.com/en-us/library/bda9bbfx(vs.71).aspx(http://msdn2.microsoft.com/en-us/library/bda9bbfx(vs.71).aspx)Page.DataBind() versus Control.DataBind() After the particular data sources have been determined and set for the objects on the .aspx page, you must bind the data to these data sources. You can use the Page.DataBind or the Control.DataBind method to bind the data to the data sources.
Both methods work similarly. The main difference is that all data sources are bound to their server controls after the Page.DataBind method is called. No data is rendered to the control until you explicitly call either the DataBind method of the Web server control or until you invoke the page-level Page.DataBind method. Typically, Page.DataBind (or DataBind) is called from the Page_Load event.
For more information about the DataBind method, see the following .NET Framework SDK documentation: Control.DataBind Method
http://msdn.microsoft.com/en-us/library/w5e5992d.aspx(http://msdn.microsoft.com/en-us/library/w5e5992d.aspx)
Data-bound list controls The list controls are special Web server controls that can bind to collections. You can use these controls to display rows of data in a customized template format. All list controls expose the DataSource and the DataMember properties, which are used to bind to collections.
These controls can bind their DataSource property to any collection that supports the IEnumerable, the ICollection, or the IListSource interface.
Repeater control The Repeater control is a templated, data-bound list. The Repeater control is “lookless;” that is, it does not have any built-in layout or styles. Therefore, you must explicitly declare all HTML layout, formatting, and style tags in the control’s templates.
The following code samples demonstrate how you can use one list control, the Repeater control, to display data:
NOTE: You must modify the parameters of the connection string as necessary for your environment.
Visual Basic .NET

<%@ Page Language=”vb” %><%@ Import Namespace=”System.Data” %><%@ Import Namespace=”System.Data.SqlClient” %><script runat=”server”>Sub Page_Load(sender As Object, e As EventArgs)Dim cnn As SqlConnection = New SqlConnection(“server=(local);” & _”database=pubs;Integrated Security=SSPI”)Dim cmd As SqlDataAdapter = New SqlDataAdapter(“select * from authors”, cnn)Dim ds As DataSet = New DataSet()cmd.Fill(ds)Repeater1.DataSource = dsRepeater1.DataBind()End Sub</script><html><body><form id=”Form1″ method=”post” runat=”server”><asp:Repeater id=”Repeater1″ runat=”server”><ItemTemplate><%# DataBinder.Eval(Container.DataItem,”au_id”) %><br> </ItemTemplate></asp:Repeater></form></body></html> Visual C# .NET

<%@ Page language=”c#” %><%@ Import Namespace=”System.Data” %><%@ Import Namespace=”System.Data.SqlClient” %><script runat=”server”>void Page_Load(Object sender, EventArgs e) {SqlConnection cnn = newSqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”);SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn);DataSet ds = new DataSet();da.Fill(ds, “authors”);Repeater1.DataSource = ds.Tables["authors"];Repeater1.DataBind();}</script><html><body><form id=”WebForm2″ method=”post” runat=”server”><asp:Repeater id=”Repeater1″ runat=”server”><ItemTemplate><%# DataBinder.Eval(Container.DataItem,”au_id”) %><br> </ItemTemplate></asp:Repeater></form></body></html> Visual J# .NET

<%@ Page language=”VJ#” %><%@ Import Namespace=”System.Data” %><%@ Import Namespace=”System.Data.SqlClient” %> <script runat=”server”>void Page_Load(Object sender, EventArgs e) {SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;IntegratedSecurity=SSPI”);SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn);DataSet ds = new DataSet();da.Fill(ds, “authors”);DataTableCollection dtc = ds.get_Tables();int index = dtc.IndexOf(“authors”);Repeater1.set_DataSource(dtc.get_Item(index));Repeater1.DataBind();}</script><html><body><form id=”WebForm2″ method=”post” runat=”server”><asp:Repeater id=”Repeater1″ runat=”server”><ItemTemplate><%# DataBinder.Eval(Container.DataItem,”au_id”) %><br></ItemTemplate></asp:Repeater></form></body></html> For more information about the Repeater control, see the following .NET Framework SDK documentation:
Repeater Web Server Control
http://msdn.microsoft.com/en-us/library/x8f2zez5.aspx(http://msdn.microsoft.com/en-us/library/x8f2zez5.aspx)DataList control The DataList class is a feature-rich, templated, data-bound list. You can modify the templates to customize this control. Unlike the Repeater control, DataList supports directional rendering and can optionally render in an HTML table at run time.
For more information about the DataList control, see the following .NET Framework SDK documentation:
DataList Web Server Control
http://msdn.microsoft.com/en-us/library/9cx2f3ks(VS.85).aspx(http://msdn.microsoft.com/en-us/library/9cx2f3ks(VS.85).aspx)DataGrid control The DataGrid control is a fully featured, multicolumn, data-bound grid. To customize the layout of individual columns in the DataGrid, you can set the column type to “templated” and modify the column’s templates. The DataGrid control can render without templates, which makes this control ideal for reporting scenarios. DataGrid also supports selection, editing, deletion, paging, and sorting by column and button columns.
For more information about the DataGrid control, see the following .NET Framework SDK documentation:
DataGrid Web Server Control
http://msdn.microsoft.com/en-us/library/aa710742(VS.71).aspx(http://msdn.microsoft.com/en-us/library/aa710742(VS.71).aspx)
Accessing data This section describes how to access data from a database and bind the data to list controls. You can use the DataSet or the DataReader class to obtain data from a database. DataSet class A DataSet contains a complete representation of data, including the table structure, the relationships between tables, and the ordering of the data. DataSet classes are flexible enough to store any kind of information from a database to an Extensible Markup Language (XML) file. DataSet classes are stateless; that is, you can pass these classes from client to server without tying up server connection resources. The following code demonstrates how to use a DataSet to bind data to a control:
NOTE: You must modify the parameters of the connection string as necessary for your environment.
Visual Basic .NET

Dim cnn As SqlConnection = New SqlConnection(“server=(local);” & _”database=pubs;Integrated Security=SSPI”)Dim cmd As SqlDataAdapter = New SqlDataAdapter(“select * from authors”, cnn)Dim ds As DataSet = New DataSet()cmd.Fill(ds)MyRepeater.DataSource = dsMyRepeater.DataBind() Visual C# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”); SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn); DataSet ds = new DataSet(); da.Fill(ds);MyRepeater.DataSource = ds;MyRepeater.DataBind(); Visual J# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”); SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn); DataSet ds = new DataSet(); da.Fill(ds); MyRepeater.set_DataSource(ds);MyRepeater.DataBind(); For more information about the DataSet class, see the following .NET Framework SDK documentation:
DataSet Class
http://msdn2.microsoft.com/en-us/library/system.data.dataset(vs.71).aspx(http://msdn2.microsoft.com/en-us/library/system.data.dataset(vs.71).aspx)DataReader class Conversely, if you only need to display (and not change) the data that is to be rendered, a DataReader class may be a better solution. For example, it is better to use a DataReader for a DropDownList control because the DataReader is a forward-only data cursor. The following code demonstrates how to use a SqlDataReader class to bind data to a control:
Visual Basic .NET

Dim cnn As SqlConnection = New SqlConnection(“server=(local);” & _”database=pubs;Integrated Security=SSPI”)Dim cmd As SqlCommand = New SqlCommand(“select * from authors”, cnn)cnn.Open()MyRepeater.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection)MyRepeater.DataBind() Visual C# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”);SqlCommand cmd = new SqlCommand(“select * from authors”, cnn);cnn.Open();MyRepeater.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);MyRepeater.DataBind(); Visual J# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”); SqlCommand cmd = new SqlCommand(“select * from authors”, cnn); cnn.Open();MyRepeater.set_DataSource(cmd.ExecuteReader(CommandBehavior.CloseConnection));MyRepeater.DataBind(); For more information about the SqlDataReader class and data access with ASP.NET, see the following topics in the .NET Framework SDK documentation:
SqlDataReader Class
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx(http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx)
Developing High-Performance ASP.NET Applications
http://msdn2.microsoft.com/en-us/library/5dws599a(vs.71).aspx(http://msdn2.microsoft.com/en-us/library/5dws599a(vs.71).aspx)
Binding in list control templates You can use templates in the list controls to bind and to customize individual records of a data source. This section includes three methods to do this. DataBinder.Eval method When the data source works with data that is returned from a database, the data source may contain numerous pieces of information. You can use the generic DataBinder.Eval method to return data. In the following code sample, the “au_id” field is returned from the data source of the container object:

<%# DataBinder.Eval(Container.DataItem,”au_id”) %> For more information about the DataBinder.Eval method, see the following .NET Framework SDK documentation:
DataBinder.Eval Method
http://msdn.microsoft.com/en-us/library/4hx47hfe.aspx(http://msdn.microsoft.com/en-us/library/4hx47hfe.aspx)Explicit casting If you need more control, use explicit casting. An explicit conversion uses a type conversion keyword. These keywords act as functions, but the compiler generates the code inline. Therefore, execution is slightly faster than with a function call. The following code samples use explicit casting:
Visual Basic .NET

‘ DataTable as the DataSource<%# CType(Container.DataItem, System.Data.DataRowView)(“au_id”) %>’ DataReader as the DataSource<%# CType(Container.DataItem, System.Data.Common.DbDataRecord)(“au_id”) %>’ DataReader as the DataSource<%# CType(Container.DataItem, System.Data.Common.DbDataRecord)(0) %> Visual C# .NET

// DataTable as the DataSource<%# ((System.Data.DataRowView)Container.DataItem)["au_id"] %> // DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)["au_id"] %>// DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)[0] %> Visual J# .NET

// DataTable as the DataSource<%# ((System.Data.DataRowView)Container.DataItem)["au_id"] %> // DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)["au_id"] %>// DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)[0] %> Note that the preceding samples use either a DataTable, which is a subset of a DataSet, or DataReader as a data source. ItemDataBound event You can also use the ItemDataBound event of the control to bind the data. This event occurs when an item is data bound to the control. The following HTML code sample defines a Repeater control with an ItemTemplate:

<asp:repeater id=rptr runat=server><itemtemplate><asp:label id=lblAuthorID runat=server /></itemtemplate></asp:repeater> The following methods are required in your page:
Visual Basic .NET

public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)’TODO: Retrieve data from a database,’and bind the data to a list control.End Subpublic Sub rptr_OnItemDataBound(ByVal sender As Object, _ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptr.ItemDataBoundDim rec As DataRowViewrec = e.Item.DataItem’Make sure that you have the data.If Not IsDBNull(rec) ThenDim l1 As Labell1 = e.Item.FindControl(“lblAuthorID”)l1.Text = rec(“au_id”).ToString()End IfEnd Sub Visual C# .NET

public void Page_Init(object sender, System.EventArgs e){rptr.ItemDataBound += new RepeaterItemEventHandler(rptr_OnItemDataBound);}public void Page_Load(object sender, System.EventArgs e){// TODO: Retrieve data from a database,// and bind the data to a list control.}public void rptr_OnItemDataBound(object sender, RepeaterItemEventArgs e){System.Data.Common.DbDataRecord rec = (System.Data.Common.DbDataRecord)e.Item.DataItem;if(rec!=null) //Make sure that you have the data.{Label l1 = (Label)e.Item.FindControl(“lblAuthorID”);l1.Text = rec["au_id"].ToString();}} Visual J# .NET

public void Page_Init(Object sender, System.EventArgs e){rptr.add_ItemDataBound(new RepeaterItemEventHandler(rptr_OnItemDataBound));}private void Page_Load(Object sender, System.EventArgs e){// TODO: Retrieve data from a database,// and bind the data to a list control.}public void rptr_OnItemDataBound(Object sender, RepeaterItemEventArgs e){System.Data.Common.DbDataRecord rec = (System.Data.Common.DbDataRecord)e.get_Item().get_DataItem();if (rec != null) //Make sure that you have the data.{Label l1 = (Label)e.get_Item().FindControl(“lblAuthorID”);l1.set_Text(((rec.get_Item(“au_id”)).ToString()));}}

List of bugs fixed in Visual Studio 6.0 Service Pack 4

Symptoms
This article contains a list of Microsoft Knowledge Base article numbers for bugs that are fixed in Visual Studio version 6.0 Service Pack 4.
Service packs are cumulative. This means that the bugs fixed in a service pack are also fixed in subsequent service packs. Click the Qxxxxxx number that precedes the title of the article to view the article about that bug.
Visual Studio Service Pack 4 is available on from the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/vstudio/Aa718362.aspx(http://msdn2.microsoft.com/en-us/vstudio/Aa718362.aspx)
Resolution
Visual Basic
183979?(http://support.microsoft.com/kb/183979/) FIX: Visual Basic UserControls within UserControls do not print in Internet Explorer
224181?(http://support.microsoft.com/kb/224181/) FIX: GDI resource leak using checkboxes in ListView control
224185?(http://support.microsoft.com/kb/224185/) FIX: User defined type in public function of a user control fails to run
232194?(http://support.microsoft.com/kb/232194/) FIX: ITC OpenUrl method does not return complete files
234317?(http://support.microsoft.com/kb/234317/) FIX: HTML page truncated with Visual Studio SP3 WebClass run time when running in the VB IDE
234771?(http://support.microsoft.com/kb/234771/) FIX: Error 800a2328 returned when browsing a Visual Basic 6.0 WebClass (IIS application)
237175?(http://support.microsoft.com/kb/237175/EN-US/) FIX: VB IDE Improperly Changes Registry Entries of ATL Object Interface When Generating OCA File
238672?(http://support.microsoft.com/kb/238672/EN-US/) FIX: Mouse Hook Not Called When Used in User Controls
239943?(http://support.microsoft.com/kb/239943/EN-US/) FIX: UserControls with Menus Cause Resource Leak
240927?(http://support.microsoft.com/kb/240927/EN-US/) FIX: Cannot Read Source File Error Running PDW Distribution
245124?(http://support.microsoft.com/kb/245124/EN-US/) FIX: VB6SP4 – Access Violation in Remote Automation Manager (Autmgr32.exe)
245159?(http://support.microsoft.com/kb/245159/EN-US/) FIX: Winsock Control SendData Only Works Over the Latest Connection
246233?(http://support.microsoft.com/kb/246233/EN-US/) FIX: Selecting a Nested UserControl DataSource Property May Cause Crash
246919?(http://support.microsoft.com/kb/246919/EN-US/) FIX: Visual Basic Crashes on Code Generated by ActiveX Control Interface Wizard
248416?(http://support.microsoft.com/kb/248416/EN-US/) FIX: Wrong TreeView Node Selected When SingleSel Property = True
248418?(http://support.microsoft.com/kb/248418/EN-US/) FIX: Unable to Develop IIS Applications (WebClasses) on Windows 2000
249607?(http://support.microsoft.com/kb/249607/EN-US/) FIX: Visual Basic 6.0 UserControl in Excel Does Not Print or Display in Print Preview
253555?(http://support.microsoft.com/kb/253555/EN-US/) FIX: Error Message ‘Report Width Is Larger Than the Paper Width’ on Exporting Data Report
242483?(http://support.microsoft.com/kb/242483/EN-US/) FIX: Error 486 or 482 Occurs When Using PrintForm
254166?(http://support.microsoft.com/kb/254166/EN-US/) BUG: Distribution of Microsoft Scripting Runtime Library Fails
257421?(http://support.microsoft.com/kb/257421/EN-US/) FIX: Compiling ActiveX Project Does Not Release Reference Correctly
257495?(http://support.microsoft.com/kb/257495/EN-US/) FIX: ListView Executes the ItemClick Event Twice with LabelEdit Set to Manual
257496?(http://support.microsoft.com/kb/257496/EN-US/) FIX: Optimized Code Incorrectly Compares Floating Point Numbers
257501?(http://support.microsoft.com/kb/257501/EN-US/) FIX: Error Message When Exporting Data Report to HTML File
257516?(http://support.microsoft.com/kb/257516/EN-US/) FIX: Button Removed from Toolbar Cannot Be Added Back
257523?(http://support.microsoft.com/kb/257523/EN-US/) FIX: Resource Leak Occurs When You Display WMF Files in a PictureBox
257524?(http://support.microsoft.com/kb/257524/EN-US/) FIX: Adding Items to ListView Control Results in IPF on Win9x
257529?(http://support.microsoft.com/kb/257529/EN-US/) FIX: MonthView’s Year is Changed When Setting DayofWeek Property
257530?(http://support.microsoft.com/kb/257530/EN-US/) FIX: Images Replicated When Customizing a Toolbar
257531?(http://support.microsoft.com/kb/257531/EN-US/) FIX: Wrong Large Currency Values Returned from Late Bound Object
257543?(http://support.microsoft.com/kb/257543/EN-US/) FIX: MouseDown Event Fires Unexpectedly on Modal Form
257550?(http://support.microsoft.com/kb/257550/EN-US/) FIX: An Invalid Page Fault Error Occurs When You Use a DataReport
257572?(http://support.microsoft.com/kb/257572/EN-US/) FIX: Error Message ‘Missing Dependency Information’ for Mshtml.tlb When Using PDW
257630?(http://support.microsoft.com/kb/257630/EN-US/) FIX: Exception Error Closing an Application Containing a CoolBar Control
257635?(http://support.microsoft.com/kb/257635/EN-US/) FIX: DataGrid Loses Focus After You Cancel AddNew
257641?(http://support.microsoft.com/kb/257641/EN-US/) FIX: DataSource Drop-Down List Box Loads Slowly in Large Projects
257645?(http://support.microsoft.com/kb/257645/EN-US/) FIX: Setting Windowless Control to Transparent Prevents Animation
257657?(http://support.microsoft.com/kb/257657/EN-US/) FIX: Edit/Update Fails for SQL 7.0 for Column of Type Text When CursorDriver Is Set to rdUseODBC
257660?(http://support.microsoft.com/kb/257660/EN-US/) FIX: Setting Printer Object Reference to Nothing Causes IPF
257661?(http://support.microsoft.com/kb/257661/EN-US/) FIX: Double-Click Event of a Form May Fire the SSTab’s GotFocus and Click Events
257664?(http://support.microsoft.com/kb/257664/EN-US/) FIX: Object in a DLL on a Non-UI Thread Disables Modeless Forms in UI Thread
257686?(http://support.microsoft.com/kb/257686/EN-US/) FIX: Double-Clicking ListBox Control Causes Invalid Page Fault
257691?(http://support.microsoft.com/kb/257691/EN-US/) FIX: Dynamically Loaded UserControl Does Not Send Edits in Data-Bound Textboxes to Data Source
257692?(http://support.microsoft.com/kb/257692/EN-US/) FIX: Resource Leak if Control’s IMEMode Is Greater Than 0 (International Versions)
257695?(http://support.microsoft.com/kb/257695/EN-US/) FIX: Invalid Page Fault When Using Data Environment Designer
257703?(http://support.microsoft.com/kb/257703/EN-US/) FIX: ListView Control Still Active After Opening Modal Form
257707?(http://support.microsoft.com/kb/257707/EN-US/) FIX: Recordset Not Updated After Invoking the Move Method
257710?(http://support.microsoft.com/kb/257710/EN-US/) FIX: PointSelected of MSChart May Return Wrong DataPoint Value
257712?(http://support.microsoft.com/kb/257712/EN-US/) FIX: DBCS Characters Cause Duplicate Column Name When Using Jet 4
257714?(http://support.microsoft.com/kb/257714/EN-US/) FIX: ADO DataControl and DataEnvironment Events Only Work with ADO 2.0
257728?(http://support.microsoft.com/kb/257728/EN-US/) FIX: Client Winsock Control Never Connects to Server Control on Same Form
257730?(http://support.microsoft.com/kb/257730/EN-US/) FIX: PrintForm Method of a Form Containing a UserControl Causes IPF
257741?(http://support.microsoft.com/kb/257741/EN-US/) FIX: UserControl Validate Event Hangs the VB IDE
257777?(http://support.microsoft.com/kb/257777/EN-US/) FIX: Printer.Height May Eject the Wrong Amount of Paper with Some Dot Matrix Printers
257779?(http://support.microsoft.com/kb/257779/EN-US/) FIX: Printer Dialog of DataReport PrintReport Method Always Shows Portrait
257780?(http://support.microsoft.com/kb/257780/EN-US/) FIX: Unrecognized Database Format Error with Data Control or Data Form Wizard
257782?(http://support.microsoft.com/kb/257782/EN-US/) FIX: Visual Basic IDE Crashes Changing Control’s Name in Properties Window
257783?(http://support.microsoft.com/kb/257783/EN-US/) FIX: Function Returning Double Followed by Numeric Label Causes Crash
257784?(http://support.microsoft.com/kb/257784/EN-US/) FIX: ARROW Key Does Not Work on Cells that Contain Double-Byte Chars on Japanese Windows
257786?(http://support.microsoft.com/kb/257786/EN-US/) FIX: IPF in Msvbvm60.dll When Showing a Data Report After a Modal Form
257787?(http://support.microsoft.com/kb/257787/EN-US/) FIX: Program with UserControl Causes Access Violation When Exiting
257788?(http://support.microsoft.com/kb/257788/EN-US/) FIX: Navigating DataGrid Using Row Selector Fails to Submit Updates
257789?(http://support.microsoft.com/kb/257789/EN-US/) FIX: Data Source Is Not Updated When PropertyChanged Is Called
257792?(http://support.microsoft.com/kb/257792/EN-US/) FIX: TreeView NodeClick Events May Fire Despite Cancel = True
260098?(http://support.microsoft.com/kb/260098/EN-US/) FIX: Cannot Set the ComboBox Text in the Click Event in Visual Basic 6.0
257778?(http://support.microsoft.com/kb/257778/EN-US/) BUG: Closing Two MDI Child Forms Rapidly Results in an Invalid Page Fault
257732?(http://support.microsoft.com/kb/257732/EN-US/) BUG: VB6SP4 – GDI Resource Leak When UserControl’s MaskPicture Is Set to An Icon
257772?(http://support.microsoft.com/kb/257772/EN-US/) BUG: Updates to Textbox Bound to Remote Data Control Fail with rdUseClientBatch
257658?(http://support.microsoft.com/kb/257658/EN-US/) BUG: RDO BatchCollisionCount is Incorrect after BatchUpdate to SQL Server 7 Database
248837?(http://support.microsoft.com/kb/248837/EN-US/) Access Violation in VBA6.DLL During Compilation When Using SP3 Version of VBA6.DLL
Visual C++
167359?(http://support.microsoft.com/kb/167359/EN-US/) FIX: extern Declaration Generates Extra Constructor Call
231655?(http://support.microsoft.com/kb/231655/EN-US/) FIX: VC++ Stops Responding Opening Files or Adding Files to Projects
231872?(http://support.microsoft.com/kb/231872/EN-US/) FIX: Using #import May Cause Memory Leaks
234511?(http://support.microsoft.com/kb/234511/EN-US/) FIX: BUG: Visual C++ 6.0 Compiler Does Not Remove Some Unneeded Instruction
234602?(http://support.microsoft.com/kb/234602/EN-US/) FIX: /Og Generates Bad Code for a Compare/Branch
235434?(http://support.microsoft.com/kb/235434/EN-US/) FIX: ‘Attach to Process’ List Is Empty
243599?(http://support.microsoft.com/kb/243599/EN-US/) FIX: VC Debugger Fails on Some Long Names
248477?(http://support.microsoft.com/kb/248477/EN-US/) FIX: Deadlock Using STL Map or Set In Multithreaded Application
251362?(http://support.microsoft.com/kb/251362/EN-US/) FIX: Suspend and Resume Thread Hangs Visual C++ Debugger
229889?(http://support.microsoft.com/kb/229889/EN-US/) QuickView Command Is Missing from Windows 2000
256056?(http://support.microsoft.com/kb/256056/EN-US/) FIX: DllMain Throws Unhandled Exception with DLL_THREAD_DETACH
256158?(http://support.microsoft.com/kb/256158/EN-US/) FIX: Text May Appear Truncated in MFC Applications Localized for Japanese Windows 2000
256329?(http://support.microsoft.com/kb/256329/EN-US/) FIX: Opening a CFileDialog from Handler of a Custom CFileDialog Causes Access Violation
259723?(http://support.microsoft.com/kb/259723/EN-US/) FIX: Debugger Fails on Fast Dual Processors
259726?(http://support.microsoft.com/kb/259726/EN-US/) FIX: Debugger Encounters Invisible Breakpoints in Assembly Code
259746?(http://support.microsoft.com/kb/259746/EN-US/) FIX: C1001 Compiler Error When Virtual Function Used as a Parameter
260172?(http://support.microsoft.com/kb/260172/EN-US/) FIX: MFC ISAPI Parse Functions Fail Under Stress on Multiple-CPU Computers
262515?(http://support.microsoft.com/kb/262515/EN-US/) FIX: /GT Compiler Switch May Cause Access Violation (AV) During Thread Switches
262698?(http://support.microsoft.com/kb/262698/EN-US/) FIX: Visual C++ 6.0 Debugger Stops Responding on Multiprocessor Computers
201641?(http://support.microsoft.com/kb/201641/EN-US/) FIX: Euro Symbol in ODL/IDL File Causes Visual C++ IDE to Stop Responding
Visual FoxPro
217174?(http://support.microsoft.com/kb/217174/EN-US/) FIX: APPEND FROM TYPE XL8 Makes VFP 6 Disappear
221745?(http://support.microsoft.com/kb/221745/EN-US/) FIX: C0000005 Fatal Error Using GETPEM() in Loop with Debugger
238945?(http://support.microsoft.com/kb/238945/EN-US/) FIX: Repeatedly Manipulating Data in Editbox Causes Error Message
250059?(http://support.microsoft.com/kb/250059/EN-US/)FIX: Accessing Printer Drivers After Issuing SYS(1037) Might Cause Error
258428?(http://support.microsoft.com/kb/258428/EN-US/) FIX: Printer Name Longer than 64 Characters Causes Error
258530?(http://support.microsoft.com/kb/258530/EN-US/) FIX: Multiple References to File Object of Project Causes OLE Error
258532?(http://support.microsoft.com/kb/258532/EN-US/) FIX: Random Characters in Report Do Not Print Under Localized Windows
258533?(http://support.microsoft.com/kb/258533/EN-US/) FIX: Cannot Resize Grid Column Widths Under Localized Windows
258536?(http://support.microsoft.com/kb/258536/EN-US/) FIX: UP ARROW Key Not Working in Code Editor Under Hebrew Windows
258537?(http://support.microsoft.com/kb/258537/EN-US/) FIX: Config.fpw Setting for Terminal Server Environment
258736?(http://support.microsoft.com/kb/258736/EN-US/) FIX: Multi-Threaded DLL Is Slow to Release Connection Under MTS
258737?(http://support.microsoft.com/kb/258737/EN-US/) FIX: DataSession Property Cannot Be Set in Session Subclass
262789?(http://support.microsoft.com/kb/262789/EN-US/) INFO: New SYS(2800) Function Improves Magnifier Accessibility Tool
262878?(http://support.microsoft.com/kb/262878/EN-US/) FIX: Fatal Exception with Large Number of Variables or Objects
Visual InterDev
259485?(http://support.microsoft.com/kb/259485/EN-US/) FIX: Devenv.exe Application Error (0×67bbfbdf) Occurs When You Are Using Visual InterDev 6.0
243809?(http://support.microsoft.com/kb/243809/EN-US/) BUG: Recordset DTC Does Not Recognize Data Connection; Connection Information Appears in Red
261150?(http://support.microsoft.com/kb/261150/EN-US/) FIX: Visual InterDev Incorrectly Determines Web Server Version
261152?(http://support.microsoft.com/kb/261152/EN-US/) FIX: Visual InterDev Returns Generic ‘Unable to Contact Web Server’ Error
261153?(http://support.microsoft.com/kb/261153/EN-US/) INFO: Can’t Create/Modify SQL Server 2000 Table, View, Diagram
262601?(http://support.microsoft.com/kb/262601/EN-US/) FIX: Menu Does Not Appear When You Right-Click in the Query Builder
Visual SourceSafe
230702?(http://support.microsoft.com/kb/230702/EN-US/) FIX: Errors When Renaming or Deleting a Project in Visual SourceSafe
236810?(http://support.microsoft.com/kb/236810/EN-US/) FIX: Command Line GET Fails with ‘Unable to finish writing file’ Error
237184?(http://support.microsoft.com/kb/237184/EN-US/) FIX: Branching from Label Causes Error ‘You do not have access rights to $/’
244960?(http://support.microsoft.com/kb/244960/EN-US/) FIX: Analyze and DDUPD Return ‘Out of Memory’
244961?(http://support.microsoft.com/kb/244961/EN-US/) FIX: Analyze.exe -f Replaces Project Data Files with a 0 Byte File
248760?(http://support.microsoft.com/kb/248760/EN-US/) FIX: Project Log ‘Physical Filename’ has a Share (From Another Project)
259902?(http://support.microsoft.com/kb/259902/EN-US/) FIX: Installation of Service Pack 4 Does Not Update Readmess.htm with Latest Version
259915?(http://support.microsoft.com/kb/259915/EN-US/) FIX: Analyze.exe Corrupts MBCS File Names When First 8 Bytes Are Same Text
Visual Studio
260049?(http://support.microsoft.com/kb/260049/EN-US/) FIX: Database Problems with Nulls and Data Type Precision
260092?(http://support.microsoft.com/kb/260092/EN-US/) FIX: If You Create a Table With Query Analyzer from Visual InterDev then the SQL Enterprise Manager Inserts the Incorrect Decimal (9, 0) Values
260095?(http://support.microsoft.com/kb/260095/EN-US/) FIX: Table Created in Visual Studio Is Not Owned by the DBO Who Created It
260128?(http://support.microsoft.com/kb/260128/EN-US/) FIX: SP4 JPN: Several Files are in English Instead of Japanese
250334?(http://support.microsoft.com/kb/250334/EN-US/) PRB: MSDN Library Unable to Display Help from Within Visual Studio Programs
260030?(http://support.microsoft.com/kb/260030/EN-US/) FIX: Visual Studio Service Pack 3 Does Not Update Hhcrtl.ocx and Itss.dll
260032?(http://support.microsoft.com/kb/260032/EN-US/) FIX: Incorrect Versions of VFP6.exe and VB6.exe in Visual Studio 6
260051?(http://support.microsoft.com/kb/260051/EN-US/) FIX: Compatibility Problems with the Redistribution Files in the Oleaut32.dll File
260085?(http://support.microsoft.com/kb/260085/EN-US/) DOC: The Japanese Translated Version of Visual Studio Service Pack 3 Readme Contains Errors
260086?(http://support.microsoft.com/kb/260086/EN-US/) FIX: DataTools: Resource ID #1634 ‘Where’ Is Mistakenly Translated into Japanese
260094?(http://support.microsoft.com/kb/260094/EN-US/) FIX: The Schema Designer Does Not Support the Precision of DECIMAL and NUMERIC Data-Types that are More than 29 Places
260104?(http://support.microsoft.com/kb/260104/EN-US/) The Willamette Processor Name Has Changed
260140?(http://support.microsoft.com/kb/260140/EN-US/) FIX: The Msdis110.dll File Is Not Updated by the Installation of Windows NT 4 Service Pack 4
262768?(http://support.microsoft.com/kb/262768/EN-US/) FIX: SQL Enterprise Manager Causes Access Violations When You Resize the Grid in the Design View
262909?(http://support.microsoft.com/kb/262909/EN-US/) FIX: FIX: Query Design Table Is Cut Off in Korean Windows 2000

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|+—————————————————————————–+

HOWTO: Subclass a UserControl

Symptoms
In Windows programming terminology, subclassing is the process of creatinga message handling procedure to intercept messages for a given window,handling those messages, and passing any remaining messages to the window’soriginal message handler.
This article demonstrates how to subclass a UserControl in Visual Basicusing the AddressOf operator.
Resolution
WARNING: One or more of the following functions are discussed in this article; VarPtr, VarPtrArray, VarPtrStringArray, StrPtr, ObjPtr. These functions are not supported by Microsoft Technical Support. They are not documented in the Visual Basic documentation and are provided in this Knowledge Base article “as is.” Microsoft does not guarantee that they will be available in future releases of Visual Basic.
In Visual Basic, the AddressOf operator is used to specify whichfunction in a code module (.BAS file) will be the message handlingprocedure. The subclass procedure is basically a message filter thatperforms non-default processing for a few key messages, and passes othermessages to a default window procedure using CallWindowProc API. TheCallWindowProc API function passes a message to the Windows system, which,in turn, sends the message to the specified window procedure.
When subclassing a UserControl with the AddressOf operator, you must takeinto account that multiple instances of the control utilize the same codemodule and its functions. In order for the UserControl to maintain its”own” message handling function, the common procedure in the module needsto forward the messages to the proper instance of the UserControl.
To implement a function for each instance of a UserControl, you need tocreate a function in the UserControl to process the messages. The currentrequirement of Visual Basic is that the AddressOf operator can only beused for functions residing in a .BAS module. Therefore, the function inthe .BAS module must forward the message to the correct instance of theUserControl.

The following steps show how to create a UserControl that detects mouseactivation at design-time and run-time.
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWNRISK. Microsoft provides this code “as is” without warranty of any kind, either express or implied, including but not limited to the impliedwarranties of merchantability and/or fitness for a particular purpose.
WARNING: Failure to unhook a window before its imminent destruction willresult in application errors, Invalid Page Faults, and data loss. This isdue the fact that the new WindowProc function being pointed to no longerexists, but the window has not been notified of the change. Always unhookthe sub-classed window upon unloading the sub-classed UserControl orexiting the application. This is especially important while debugging anapplication that uses this technique within the Microsoft Visual BasicDevelopment Environment. Pressing the End button or selecting End from theRun menu without unhooking will cause an Invalid Page Fault and closeMicrosoft Visual Basic.
Step-by-Step ExampleStart Visual Basic and create a new ActiveX Control Project.”UserControl1″ is created by default.Add the following code to the UserControl1 code module:

Option Explicit’mWndProcOrg holds the original address of the’Window Procedure for this window. This is used to’route messages to the original procedure after you’process them.Private mWndProcOrg As Long’Handle (hWnd) of the subclassed window.Private mHWndSubClassed As Long’Constant for Windows Message used in sample.Private Const WM_MOUSEACTIVATE = &H21Private Sub SubClass()’————————————————————-’Initiates the subclassing of this UserControl’s window (hwnd).’Records the original WinProc of the window in mWndProcOrg.’Places a pointer to the object in the window’s UserData area.’————————————————————-’Exit if the window is already subclassed.If mWndProcOrg Then Exit Sub’Redirect the window’s messages from this control’s default’Window Procedure to the SubWndProc function in your .BAS’module and record the address of the previous Window’Procedure for this window in mWndProcOrg.mWndProcOrg = SetWindowLong(hWnd, GWL_WNDPROC, _AddressOf SubWndProc)’Record your window handle in case SetWindowLong gave you a’new one. You will need this handle so that you can unsubclass.mHWndSubClassed = hWnd’Store a pointer to this object in the UserData section of’this window that will be used later to get the pointer to’the control based on the handle (hwnd) of the window getting’the message.Call SetWindowLong(hWnd, GWL_USERDATA, ObjPtr(Me))End SubPrivate Sub UnSubClass()’———————————————————–’Unsubclasses this UserControl’s window (hwnd), setting the’address of the Windows Procedure back to the address it was’at before it was subclassed.’———————————————————–’Ensures that you don’t try to unsubclass the window when’it is not subclassed.If mWndProcOrg = 0 Then Exit Sub’Reset the window’s function back to the original address.SetWindowLong mHWndSubClassed, GWL_WNDPROC, mWndProcOrg’0 Indicates that you are no longer subclassed.mWndProcOrg = 0End SubFriend Function WindowProc(ByVal hWnd As Long, _ByVal uMsg As Long, ByVal wParam As Long, _ByVal lParam As Long) As Long’————————————————————–’Process the window’s messages that are sent to your UserControl.’The WindowProc function is declared as a “Friend” function so’that the .BAS module can call the function but the function’cannot be seen from outside the UserControl project.’————————————————————–’Start Demo Code: Changes the color of the UserControl each’time the control is clicked in design-time from red to blue’or from blue to red.If uMsg = WM_MOUSEACTIVATE ThenIf UserControl.BackColor = vbRed ThenUserControl.BackColor = vbBlueElseUserControl.BackColor = vbRedEnd IfEnd If’End Demo Code.’Forwards the window’s messages that came in to the original’Window Procedure that handles the messages and returns’the result back to the SubWndProc function.WindowProc = CallWindowProc(mWndProcOrg, hWnd, _uMsg, wParam, ByVal lParam)End FunctionPrivate Sub UserControl_Initialize()’Occurs the first time a UserControl is placed on a container.UserControl.BackColor = vbRedSubClassEnd SubPrivate Sub UserControl_Terminate()UnSubClassEnd Sub Add new Standard Module (.BAS) to the project and add the followingcode:

Option Explicit’API Declarations used for subclassing.Public Declare Sub CopyMemory _Lib “kernel32″ Alias “RtlMoveMemory” _(pDest As Any, _pSrc As Any, _ByVal ByteLen As Long)Public Declare Function SetWindowLong _Lib “user32″ Alias “SetWindowLongA” _(ByVal hWnd As Long, _ByVal nIndex As Long, _ByVal dwNewLong As Long) As LongPublic Declare Function GetWindowLong _Lib “user32″ Alias “GetWindowLongA” _(ByVal hWnd As Long, _ByVal nIndex As Long) As LongPublic Declare Function CallWindowProc _Lib “user32″ Alias “CallWindowProcA” _(ByVal lpPrevWndFunc As Long, _ByVal hWnd As Long, _ByVal Msg As Long, _ByVal wParam As Long, _ByVal lParam As Long) As Long’Constants for GetWindowLong() and SetWindowLong() APIs.Public Const GWL_WNDPROC = (-4)Public Const GWL_USERDATA = (-21)’Used to hold a reference to the control to call its procedure.’NOTE: “UserControl1″ is the UserControl.Name Property at’design-time of the .CTL file.’(‘As Object’ or ‘As Control’ does not work)Dim ctlShadowControl As UserControl1′Used as a pointer to the UserData section of a window.Dim ptrObject As Long’The address of this function is used for subclassing.’Messages will be sent here and then forwarded to the’UserControl’s WindowProc function. The HWND determines’to which control the message is sent.Public Function SubWndProc( _ByVal hWnd As Long, _ByVal Msg As Long, _ByVal wParam As Long, _ByVal lParam As Long) As LongOn Error Resume Next’Get pointer to the control’s VTable from the’window’s UserData section. The VTable is an internal’structure that contains pointers to the methods and’properties of the control.ptrObject = GetWindowLong(hWnd, GWL_USERDATA)’Copy the memory that points to the VTable of our original’control to the shadow copy of the control you use to’call the original control’s WindowProc Function.’This way, when you call the method of the shadow control,’you are actually calling the original controls‘ method.CopyMemory ctlShadowControl, ptrObject, 4′Call the WindowProc function in the instance of the UserControl.SubWndProc = ctlShadowControl.WindowProc(hWnd, Msg, _wParam, lParam)’Destroy the Shadow Control CopyCopyMemory ctlShadowControl, 0&, 4Set ctlShadowControl = NothingEnd Function NOTE: If your UserControl is not named UserControl1, you need to changethe “Dim ctlControl As UserControl1″ line of code to indicate thecorrect name of your UserControl as specified by its Name property.
Close all the project windows that may be open and save the project.NOTE: During subclassing, you do not want to stop the executing code orit will cause an exception. Always save your project before testing anysubclassing code.
From the File menu, select “Add Project…” and add a Standard EXEproject. This will be your test project. It is named Project2 bydefault.Open the default form (Form1) of Project2 and place an instance of theUserControl on the form. It should appear as a red rectangle.Each time the mouse is clicked on the UserControl, it should toggle itscolor between red and blue.Place a second instance of the UserControl on the form. Note that thesubclassing works independently on each control, sending the messages tothe appropriate control.

How To Implement Nested Transactions with Oracle

Symptoms
ADO and ODBC do not support nested transactions. However, native Oracle SQLsupports the SAVEPOINT keyword that can be used to simulate nestedtransactions.
Resolution
The Microsoft Knowledge Base article 177138?(http://support.microsoft.com/kb/177138/EN-US/), entitled “INFO: NestedTransactions Not Available in ODBC/OLE DB/ADO” says this about nestedtransactions:
“Neither Open Database Connectivity (ODBC, nor any released MicrosoftOLE DB Provider supports Nested Transactions. ActiveX Data Objects (ADO)supports the feature, but only if the underlying provider exposes it.Currently none of Microsoft’s OLE DB providers support NestedTransactions.”
This is true for the Microsoft ODBC for Oracle driver. However, by usingthe SAVEPOINT keyword, you can simulate Nested Transactions. For moreinformation about native ODBC or ADO support for Nested Transactions,please see the article mentioned above.
The SAVEPOINT keyword basically sets a bookmark for uncommitted statementsin an Oracle session. You can rollback these statements by using the TOoption with the ROLLBACK statement. This all has to be done through Executestatements (such as in the form of <connection>.Execute) because the ODBCparser cannot parse the SAVEPOINT keyword properly.
The following code shows how this all works:

Conn = “UID=****;PWD=****;DRIVER={Microsoft ODBC for Oracle};” _& “SERVER=SamOracle;”Set Cn = New ADODB.ConnectionWith Cn.ConnectionString = Conn.CursorLocation = adUseClient.OpenEnd WithCn.BeginTransCn.Execute “SAVEPOINT ALPHA”Cn.Execute “INSERT INTO trantest VALUES(1,10)”Cn.Execute “INSERT INTO trantest VALUES(2,10)”Cn.Execute “SAVEPOINT BETA”Cn.Execute “INSERT INTO trantest VALUES(3,10)”Cn.Execute “INSERT INTO trantest VALUES(4,10)”Cn.Execute “ROLLBACK TO SAVEPOINT BETA”Cn.Execute “COMMIT”Cn.RollbackTrans NOTE: This assumes a table “Trantest” exists on the Oracle server.
This code will commit the first two INSERT statements and rollback thesecond two. You will notice that the whole set of statements is surroundedwith a CONNECTION level BeginTrans and CommitTrans. This is necessary sothat, at the ODBC API level, the SQLSetConnectOption SQL_AUTOCOMMIT is setto SQL_AUTOCOMMIT_OFF. After you have finished your transaction it is agood idea to re-set SQL_AUTOCOMMIT to SQL_AUTOCOMMIT_ON (the default) byexecuting either a CommitTrans or a RollbackTrans. Because you have eithercommitted or rolled backed your transactions with your Execute statements,it doesn’t matter whether you call CommitTrans or RollbackTrans; eitherway, they have nothing to commit or rollback. You are just calling thesefunctions to reset SQL_AUTOCOMMIT to SQL_AUTOCOMMIT_ON, which they both do.