MikeD
11/23/2010 6:33:00 AM
"BeeJ" <nospam@spamfree.com> wrote in message
news:icf1jv$8mq$1@speranza.aioe.org...
> message box pops up saying to look at .log file.
>
> In a frm.log file
> Line 65: Property Left in sbrStatus could not be set.
> Line 65: Property Width in sbrStatus could not be set.
>
> Line 65 ? 65 from where? Line 65 has some enum stuff unrelated to a
> statusbar.
>
> I scanned the code and I am only setting the minimum width.
> I have error handling there. On Error Resume Next.
> I only get this error after the second time I try to open the form.
> The first time I get no errors.
>
> I cannot find anything in help.
> Is this related to putting a message on the statusbar or just resizing?
>
>
Ralph gave some good advice. I just have a couple more comments.
First, this is not likely due to any code you've written. If the IDE is
giving you this error when you open a project or a specific form in a
project, it's most likely due to something being "not right" in the part of
the .frm file that defines all the controls on the form and their properties
(it's not actual code) . First thing I would do is immediately make a backup
of the .frm file so that you can "play" with it and at least be no worse off
than you are now. Just copying the file to another folder is sufficient.
After you've backed it up, open it in Notepad or any other text editor (make
sure it's a text editor that won't add tags or codes to the file when
saved). Search for the text "Begin MSComctlLib.StatusBar sbrStatus" if
you're using Windows Common Controls 6 OR for "Begin ComctlLib.StatusBar
sbrStatus" if you're using Windows Common Controls 5. Immediately under this
and indented, you'll see lines for properties that have non-default values.
Pay particular attention to what is "assigned" for the Left and Width. One
or the other or both might be something really weird or perhaps a negative
value, and thusly pretty obvious that it's the problem.
Normally, a status bar will be the entire client width of the form. Now, if
you look back up in the file (how far up depends on how many controls are on
the form and where they happen to be defined in the .frm file) you should
see a value for the form's ClientWidth (make sure it's the form's property
as other controls could have the same property). Edit the status bar's
width to be the same and make the status bar's left to be 0. Save the .frm
file. Try to open the project again in VB. If you're lucky, everything will
be fine. If not, the fix isn't as simple as that and you might be better
off removing the status bar control from your form and re-adding it (in the
IDE, assuming the IDE will still show the form). You might be better off
just doing that anyway. Again, just make sure you've got a backup/copy of
the .frm file. At worst, you may just have to copy and paste some code
(from your backup) if you've written anything in the status bar's event
procedures.
For what it's worth, I experimented a bit. I opened a "good" .frm file that
had a StatusBar control on it in Notepad. I changed the Width to be a
negative number. I saved it and then opened the project containing this form
in VB. No errors when I opened the project, probably because the form didn't
automatically display. But sure enough, when I displayed the form, I got
the "Errors during load. Refer to '<path>\<filename.log>' for details"
message. Opening the log file had "Property Width in sbrStatus could not be
set." The form still displayed though and the StatusBar was there. It had
just reset itself to defaults, exactly the same as if you'd added it to the
form by double-clicking its toolbox icon rather than drawing it on the form.
I just reset its height, saved the project, and everything was fine.
So...my analysis is that you may have just panicked too soon. <g> Even when
I intentionally tried to screw things up, it didn't really screw anything
up. All I had to do was reset the height after getting the error.
--
Mike