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 for June, 2010

BUG: Error 424 Adding Data Object Wizard-Created Ctrl to Form

Symptoms
When you try to place a user control that was created using the Data ObjectWizard onto a form, Error 424 (“Object Required”) occurs.
Resolution
When you place a user control on a form, that control’s Resize event isexecuted. If you create a list box or combo box type of user control usingthe Data Object Wizard, that control’s Resize event refers to the containedlist box or combo box incorrectly and causes error 424, “Object required.”

BUG: Error “Row Cannot Be Located for Updating” If You Change Numeric Field in ADODC Recordset

Symptoms
If an ActiveX Data Objects data control (ADODC) is bound to a Microsoft Access table that specifies a default value for the numeric field, when you take the following actions:Add a new record to the ADO recordset, which the ADODC exposes, without entering a value for that numeric field.Update the recordset.Type a value into the numeric field (either directly into the Recordset field or into the corresponding DataGrid cell) in that same newly-added record.Update the recordset again.the following run-time error is raised with error number -2147217864 (80040e38) or 6153:

Row cannot be located for updating. Some values may have changed since it was last read.If a DataGrid control is bound to the ADODC, the same error message usually appears a second time without an error number in a dialog box that is entitled “Microsoft DataGrid Control.”
Resolution
To resolve this problem, remove the default value that is specified for the numeric field in the Access database table.
Alternately, you can run an UPDATE statement on a separate ADO Connection object to update the numeric field in the newly-added record directly in the database and then refresh the ADODC.

BUG: Element may cause Data View to generate an error message

Symptoms
When you view an XML document with Data View in the Microsoft Visual Studio .NET integrated development environment (IDE), you may receive the following error message:

Although this XML document is well formed, it contains structure that Data View cannot display.
The grid cannot show the data correctly because of the unsupported character “.” in element name(s).
Resolution
The XML document has an element name that contains a period (.), and the period (.) is an unsupported character.

BUG: Design Option in Pop-up Menu Data View Window Not Available

Symptoms
If you use a Windows NT 4.0 computer and are not a member of the administrators group, you will not get the Design option in the pop-up menu for a table when you right-click on on the table in the Data View Window of Microsoft Visual Basic 6.0.
NOTE: This bug does not occur on Windows 2000 machines.
Resolution
The Visual Basic IDE is incorrectly determining that the Design option should not be shown unless you belong to the administrators group.

BUG: DBGrid Align Before Retrieve Fields Causes Hidden Data

Symptoms
Setting the Alignment property of a column in a DBGrid control at design-time, before selecting Retrieve Fields, results in the grid not showing anydata when the application is run.
Resolution
At design time, select Retrieve Fields from the custom control propertydialog box. Any changes made to the Alignment properties of columns in thegrid will no longer cause this problem. If the DatabaseName andRecordSource properties of the data control are not known until the programis run, using Retrieve Fields won’t be an option. In this case, just setthe Alignment property of the column(s) in question at run time, like this:

DBGrid1.Columns(0).Alignment = 2’select center alignment

BUG: DataGrid Web Server control wraps when the ItemStyle Wrap property or the HeaderStyle Wrap property is set to false in Visual Basic .NET

Symptoms
When you set the HeaderStyle Wrap or the ItemStyle Wrap property to False, data is still wrapped in the columns of the DataGrid Web control.
Resolution
The wrap functionality occurs for each cell and not for each row of the DataGrid. Therefore, if you set the wrap functionality for all of the DataGrid, text wrapping functionality is not disabled for every row or column.