By
admin, December 5, 2010
Symptoms
A Visual Basic 6.0 Standard EXE project contains several data-bound UserControls of the same type on a form. One property of the UserControl isbound to an OLE DB Simple data source at run-time after the form is loaded. The bindings are added by looping through the Form.Controls collection. The property attribute is set to “immediate update” at UserControl design time.
In the Visual Basic integrated development environment (IDE), changes to the bound properties are correctly reflected back to the underlying data source as soon as the PropertyChanged method is called.
However, when you run the compiled EXE, the underlying data source of the control is only updated when the control focus is moved to any other control on the form.
Resolution
To resolve this problem, install the latest service pack for Visual Studio 6.0.
By
admin, August 25, 2010
Add Embedded Resources
To add a text file and an image file to your project as embedded resources, follow these steps:
- Create a new Windows Application project for this demonstration. This form is used to display the resources that are accessed from the executing assembly during run time.
- Right-click your project name, click Add, and then click Add New Item.
- In the New Item dialog box, select Text File from the menu, and name the file MyTextFile.txt. When the file opens in the integrated development environment (IDE), add some text, and then close the file.
- Repeat steps 1 and 2 to add a bitmap image to your project, but instead of selecting Text File as the new item type, select Bitmap File, and then change the file name to MyImage.bmp. When the new image is opened in the IDE, draw something on the image, and then close the file.
- Right-click either the text file or the bitmap, and then select Properties.
- In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource.
- Repeat steps 4 and 5 for the other file.
The next time you build the project, the compiler adds these files to your assembly. The compiler adds the root namespace of the project to the name of the resource when it is included in the project. For example, if the root namespace of your project is MyNamespace, the resources are named MyNamespace.MyTextFile.txt and MyNamespace.MyImage.bmp.