How many lables can a form suport ?

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

hi there, i'm developing an aplication that uses 4 forms.
Each form has about 2000 labels, when I try to open my
third form, an error ocurrs, but no error mesage appears.
I've realised that if I try to crate a form collection
like:

sub Test()
Dim f as new Form1
f.show
end sub

and if form1 has 300 labels and no other controls, the
program hangs, when the 33rd form appears (about 9900
labels).

It worked in VB6.0

What can I do to work this Out ?

Thanks
 
* "Peter said:
hi there, i'm developing an aplication that uses 4 forms.
Each form has about 2000 labels, when I try to open my
third form, an error ocurrs, but no error mesage appears.
I've realised that if I try to crate a form collection
like:

sub Test()
Dim f as new Form1
f.show
end sub

and if form1 has 300 labels and no other controls, the
program hangs, when the 33rd form appears (about 9900
labels).

It worked in VB6.0

Labels in VB6 were windowless controls and didn't need much memory.
..NET labels are windows. Have a look at the memory usage for the
application with the task manager.
 
Peter said:
hi there, i'm developing an aplication that uses 4 forms.
Each form has about 2000 labels, when I try to open my
third form, an error ocurrs, but no error mesage appears.
I've realised that if I try to crate a form collection
like:

sub Test()
Dim f as new Form1
f.show
end sub

and if form1 has 300 labels and no other controls, the
program hangs, when the 33rd form appears (about 9900
labels).

It worked in VB6.0

What can I do to work this Out ?

I guess you are getting a System.ComponentModel.Win32Exception? That's the
one I get. Put a try-catch block around your code and catch the exception.
The NativeErrorCode property returns 14. MSDN says:

14 | Not enough storage is available to complete this operation. |
ERROR_OUTOFMEMORY

One solution: Don't use labels. Instead, paint the text by overriding
OnPaint.

If you also use other controls like Textboxes, I'd consider using a grid,
like the DataGrid, instead.
 
Hi Peter,

I got this idea when I saw the answer from Armin,

Why do you not use one label and fill that with stringbuilder, while
increasing the hight in the same time?

Just an idea?

Cor
 
I can't use that solution, because each label must have
diferente colors, or at least be able to.

Tanks

Peter
 
Labels in VB6 were windowless controls and didn't need much memory.
.NET labels are windows. Have a look at the memory usage for the

In Delphi, there were both windowed and windowless controls. Does the same
hold true for VB.Net? What class is the base class for windowed controls
and what class is the base class for windowless controls?

Could a label control be created that is windowless?

Just wondering
 
Hi Chris,

Yes. You would associate the LiteLabel with an underlying surface and it
would draw itself thereon. Several LiteLabels could thus share the same
surface. (Make it a Graphics and it needn't even be visible - do it memory on
a Bitmap!).

Many problems with this and that to be solved, of course, not least being
how to allow the user to manage these at Design-time.

Regards,
Fergus
 
Peter,
In addition to the others comments, Charles Petzold's book "Programming
Microsoft Windows With Microsoft Visual Basic.NET" from MS Press. Gives an
example of how to paint text on a form, then identify when the mouse passes
over or presses one of the pieces of text.

Hope this helps
Jay
 
I hope I can find it on the Net

Tanks Jay
-----Original Message-----
Peter,
In addition to the others comments, Charles Petzold's book "Programming
Microsoft Windows With Microsoft Visual Basic.NET" from MS Press. Gives an
example of how to paint text on a form, then identify when the mouse passes
over or presses one of the pieces of text.

Hope this helps
Jay




.
 
Yes. You would associate the LiteLabel with an underlying surface and it

Pardon my ignorance, but what is a "LiteLabel" ? I can find no class in
the MSDN about this. Is that a name you made up?
 
Peter,
If you are searching on the web for something similar, search for 'hit test'
or 'hit testing'.

The following article discusses hit testing a line, for text I would use a
rectangle which is generally easier then a line.

http://www.bobpowell.net/hittestlines.htm

Hope this helps
Jay
 
* Chris Dunaway said:
In Delphi, there were both windowed and windowless controls. Does the same
hold true for VB.Net? What class is the base class for windowed controls
and what class is the base class for windowless controls?

Could a label control be created that is windowless?

AFAIK windowless controls are currently not supported by the .NET framework.
 
* Chris Dunaway said:
Pardon my ignorance, but what is a "LiteLabel" ? I can find no class in
the MSDN about this. Is that a name you made up?

There is no 'LiteLabel' class. Nevertheless, a "lite label" can be
created by drawing its surface onto the canvas of the underlying
control.
 
* "Cor said:
I got this idea when I saw the answer from Armin,

Why do you not use one label and fill that with stringbuilder, while
increasing the hight in the same time?

Do you want to use tabs to separate the columns?!
 
*Herfried K. Wagner [MVP]* tippselte am *22.10.2003 20:12* MESZ:
AFAIK windowless controls are currently not supported by the .NET framework.

Maybe I have an error in my thoughts, but inheriting from the
'Component' class is similar to a windowless control, isn't it?

Best regards,

Michael
 
* Michael Kremser said:
Maybe I have an error in my thoughts, but inheriting from the
'Component' class is similar to a windowless control, isn't it?

It's not a control at all.
 
Hi Chris,

LOL, I guess I should have put it in quotes like you did.

Yes, the 'LiteLabel' is a made up name for what you're suggesting. I
actually hate names that use 'Lite' - it was a bit tongue-in-cheek.

Regards,
Fergus
 
Michael,
I would agree with you in that a Component is a close cousin to a windowless
control.

I saw close cousin as I would consider a control (windowless or windowed) to
actually draw something on the screen, while components do not.

Its probably more correct that windowless controls & components are
overlapping circles where Components such as the ErrorProvider fall into the
overlapping part. Where as components such as MessageQueue do not fall into
the overlapping part.

I could see defining a control similar to how the LinkLabel works where you
can define multiple hyperlinks within the control via the Links property
might be beneficial for Peter. Note this would not be a WindowLess control.
Thinking about it I wonder if the RichTextControl could also be made to
work.

Hope this helps
Jay
 
*Herfried K. Wagner [MVP]* tippselte am *22.10.2003 20:34* MESZ:
It's not a control at all.

Yeah, that's right, it is definitely no control. But is a windowless
control in VB <7 really a "control"? I think it is just named a
"control" for some reason.

Best regards,

Michael
 
* Michael Kremser said:
Yeah, that's right, it is definitely no control. But is a windowless
control in VB <7 really a "control"? I think it is just named a
"control" for some reason.

Mhm... It can receive events and its a user interface element.
 
Back
Top