[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Anton

11/23/2010 12:25:00 AM

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?


5 Answers

ralph

11/23/2010 3:44:00 AM

0

On Mon, 22 Nov 2010 16:24:33 -0800, BeeJ <nospam@spamfree.com> wrote:

>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?
>

As one normally gets these kinds of errors with a Form log report, on
opening a 'Project' and not on 'opening' a Form within the IDE it
would be helpful to have a bit more detail on what it is you are
actually doing and what you mean by "opening" - .Show? Clicking a Form
in the project list? ...

HOWEVER, this error is caused by a variety of things that all amount
to the same thing - VB6 is confused. <g>

It can occur because of a mismatched .frx file, wrong component
version, creative aliasing, VB's ETC, etc. In many cases the exact
problem is never discovered, or is found someplace else quite removed
from the actual control it is complaining about, and corrects itself
with a bit of restructuring or modification to your code or project
settings. In other words don't waste a lot of time trying to find a
single error in your code - it is likely caused by something not
readily visible.

1) Clean out your project folder.
2) Check all your references.
3) Try rebuilding the Form.

Except for the specific problems listed above (mismatched .frx, etc)
this error always seems to go away on its own when a project is
cleaned up.

Also, while I doubt it is the problem in this case, remove the On
Error Resume Next. While useful in some cases, when trouble starts it
is not your friend as it can easily mask something that might be
interesting to know.

You can easy replace it with temporary code such as ...

' comment out On Error Resume Next
On Error Goto MyResumeCatch
...
Statement of Interest
MyResume:
...

Exit Sub
MyResumeCatch:
Debug.Assert False
Debug.Print Error information
Goto MyResume

This gives you the same logical behavior but lets you peek.

Better - you might want to reconsider not using Resume Next in the
first place.

-ralph

MikeD

11/23/2010 6:33:00 AM

0



"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





Ian Post

11/23/2010 7:03:00 AM

0

Right after posting I changed the On Error Resume next to a more open
error handler.

This error does not happen on the first "open", but on the second and
subsequent openings.

air code follows

if fX is nothing then
set fX = New frmX
end if

Load fx

' the error happens right at the Form_Load of fX (frmX)
that is, before any code is executed.

then the IDE asks to save the form as if i had made some change to it.
but since it was just opened and no changes were made, i do not know
why i get this message.

Form_Load has an error handler but it does not get into the code in
form_load.


(nobody)

11/23/2010 11:57:00 AM

0

"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.

No, the line number is what you see in Notepad, not the IDE.

Is this the same form that has a UserControl that VB sometimes turns into a
PictureBox?


Ian Post

11/24/2010 12:05:00 AM

0

Nobody laid this down on his screen :
> "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.
>
> No, the line number is what you see in Notepad, not the IDE.
>
> Is this the same form that has a UserControl that VB sometimes turns into a
> PictureBox?

No. This is a different form.