Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent!! Losing Controls when adding form to project

Status
Not open for further replies.

a2ross

Programmer
Dec 6, 2000
69
AU
I have the source code for forms, modules etc for an old application but not the project file. The app uses a number of third party controls.

I have all the controls installed on my machine and have added them to a new project file but when I add forms to this project I lose the controls from the forms.

I have not had to do this previously so hope it is a simple fix as the app relies heavily on these controls and would require a major rewrite to replace them manually.

Please help as this is very urgent.
 
You are adding forms to a project that does NOT have your third party components included....

Go to Project:Components and add all of the components FIRST..

If you had the project file, you wouldn't have to do this as the controls would be referenced in your project.. Do this once and save it, and you should be all set..

 
Thanks for the input. I had already created a new project file with all the components added to it and then import the forms.

I found that these forms from an early version of VB did not contain references to the .OCX files within them whereas forms created in the current version of VB do.

For anyone else having this problem, here is what I did.

1 Create a project file with all the necessary components added and then create a dummy form with one of each of the components in question.

2 Open this file in notepad and you will see the references to the .OCX files at the top. You will also see how the components are referenced with a "Begin (component type) (component name)

3 Open your form in notepad. Copy the reference to the .OCX file(s) into your form along with just the (component type) section of the declaration for each component. Any reference to .FRX files in each component should have inverted commas around them. Save the form and then import it to your project.

This worked for me but I did lose some formatting information that was stored in the .FRX files as the current version of VB must reference these files differently.

It's a pain to do and a really good incentive not to lose your project file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top