(nobody)
3/24/2011 3:59:00 PM
Jason Keats wrote:
> I've been experimenting with unicode in VB6. So far I've just used
> Timosoft's EditControls - that is, an alternative textbox. While this
> seems to work okay, it would be a big job replacing all the controls
> on a couple of hundred forms with alternative controls because,
> unfortunately, I can't just do a search and replace on the source
> because the two textboxes have different properties. I'm guessing
> it's the same for the other controls.
If you open the FRM file with Notepad and check the list of controls, you
will find that VB only lists non-default properties, and properties
containing binary data are referred to the FRX file, like "Form1.frx":1234.
So it's easy to do Find & Replace as long as you don't see references to FRX
files for that control. Here is an example of one of my projects:
Begin VB.TextBox Text1
Height = 375
Left = 3600
TabIndex = 1
Text = "*.*"
Top = 360
Width = 1455
End
Here is an example that is using a binary property(in this case, it's Text
property because this is a multiline TextBox):
Begin VB.TextBox Text1
Height = 1575
Left = 360
MultiLine = -1 'True
TabIndex = 0
Text = "Form1.frx":0006
Top = 240
Width = 3975
End
So to replace the control with something else, just change "VB.TextBox"
above to the new control, such as "UniBox.UniTextBox", and the control would
have the same position and size as the previous control! If there are binary
properties, I recommend that you delete the value using the VB IDE and save
the project, and then view the FRM file in Notepad to see that the reference
to the FRX file is removed. So it's easy to write a parser and replace all
controls quickly.
A safer way is to make an Add-in and loop through all controls, deleting the
older ones, and adding the new ones. There are samples on the web and Planet
Source Code, but if you have never written an Add-in before, writing a
parser might be easier to do.
As for the source code, you will have to do it manually. I recommend that
you use MZToolz Find command because it lists all the results in one window,
including the number of matches, and it can exclude commented code.