473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How many lables can a form suport ?

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

Nov 20 '05 #1
27 1725
* "Peter" <pc****@spc.sapec.pt> scripsit:
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.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
"Peter" <pc****@spc.sapec.pt> schrieb
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.

--
Armin

Nov 20 '05 #3
Cor
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
Nov 20 '05 #4
I can't use that solution, because each label must have
diferente colors, or at least be able to.

Tanks

Peter
-----Original Message-----
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, whileincreasing the hight in the same time?

Just an idea?

Cor
.

Nov 20 '05 #5
On 22 Oct 2003 12:03:30 +0200, Herfried K. Wagner [MVP] wrote:
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

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #6
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
Nov 20 '05 #7
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

"Peter" <pc****@spc.sapec.pt> wrote in message
news:09****************************@phx.gbl...
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

Nov 20 '05 #8
I hope I can find it on the Net

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

Hope this helps
Jay

"Peter" <pc****@spc.sapec.pt> wrote in message
news:09****************************@phx.gbl...
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

.

Nov 20 '05 #9
On Wed, 22 Oct 2003 15:26:09 +0100, Fergus Cooney wrote:
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?

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #10
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

"Peter" <pc****@spc.sapec.pt> wrote in message
news:00****************************@phx.gbl...
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

"Peter" <pc****@spc.sapec.pt> wrote in message
news:09****************************@phx.gbl...
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

.

Nov 20 '05 #11
* Chris Dunaway <dunawayc@_lunchmeat_sbcglobal.net> scripsit:
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?


There is no 'LiteLabel' class. Nevertheless, a "lite label" can be
created by drawing its surface onto the canvas of the underlying
control.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #12
* Chris Dunaway <dunawayc@_lunchmeat_sbcglobal.net> scripsit:
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?


AFAIK windowless controls are currently not supported by the .NET framework.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #13
* "Cor" <no*@non.com> scripsit:
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 · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #14
*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
http://great.dynu.com/

Nov 20 '05 #15
* Michael Kremser <us****************@aon.at> scripsit:
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.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #16
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
Nov 20 '05 #17
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

"Michael Kremser" <us****************@aon.at> wrote in message
news:em*************@TK2MSFTNGP10.phx.gbl...
*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
http://great.dynu.com/

Nov 20 '05 #18
*Herfried K. Wagner [MVP]* tippselte am *22.10.2003 20:34* MESZ:
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.


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
http://great.dynu.com/

Nov 20 '05 #19
* Michael Kremser <us****************@aon.at> scripsit:
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.


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.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #20
*Herfried K. Wagner [MVP]* tippselte am *22.10.2003 20:58* MESZ:
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.


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.


Which is not right for the Winsock control, for example.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 20 '05 #21
*Jay B. Harlow [MVP - Outlook]* tippselte am *22.10.2003 20:45* MESZ:
I saw close cousin as I would consider a control (windowless or windowed) to
actually draw something on the screen, while components do not.


They are not required to do so, but of course they could. Howevery, I
agree with you.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 20 '05 #22
* Michael Kremser <us****************@aon.at> scripsit:
> 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.

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.


Which is not right for the Winsock control, for example.


IMO that's not a control. Nevertheless, the Label and Image controls in
VB Classic _are_ controls because they are a _user interface element_.
I mentioned this in my previous post.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #23
*Herfried K. Wagner [MVP]* tippselte am *22.10.2003 22:08* MESZ:
>>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.

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.


Which is not right for the Winsock control, for example.

IMO that's not a control. Nevertheless, the Label and Image controls in
VB Classic _are_ controls because they are a _user interface element_.
I mentioned this in my previous post.


This is exactly what I meant: The Winsock control is named 'control',
although it's no 'control' in the sense of a 'thing' that can interact
with the user and draws something on the screen. Therefore, it has the
behaviour of a 'Component' in the .net world.

Best regards,

Michael

--
Michael Kremser
http://great.dynu.com/

Nov 20 '05 #24
* Michael Kremser <us****************@aon.at> scripsit:
>>> 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.
>
> 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.

Which is not right for the Winsock control, for example.

IMO that's not a control. Nevertheless, the Label and Image
controls in

VB Classic _are_ controls because they are a _user interface element_.
I mentioned this in my previous post.


This is exactly what I meant: The Winsock control is named 'control',
although it's no 'control' in the sense of a 'thing' that can interact
with the user and draws something on the screen. Therefore, it has the
behaviour of a 'Component' in the .net world.


ACK. Nevertheless, a "litelabel" _is_ a control.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #25
Hi Herfried,
a "litelabel" _is_ a control.


Not if it's the LiteLabel that I was referring to. That's a Component
<associated> with a Control.

Regrds,
Fergus

ps. Why '>' all of a sudden and no indentation? Because how could I spoil that
lovely sequence you've built up between you!

pps. Am I and Michael in the same colour? You'd better answer before Michael
otherwise he'lll get <your> colour.
Nov 20 '05 #26
Correction. Ignore that previous post.

"Herfried K. Wagner [MVP]" intoned
* Michael Kremser <us****************@aon.at>scripsit:
>>>>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.
>>
>>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.

Which is not right for the Winsock control, for example.
IMO that's not a control. Nevertheless, the Label and Image
controls in
VB Classic _are_ controls because they are a _user interface element_.
I mentioned this in my previous post.


This is exactly what I meant: The Winsock control is named 'control',
although it's no 'control' in the sense of a 'thing' that can interact
with the user and draws something on the screen. Therefore, it has the
behaviour of a 'Component' in the .net world.


ACK. Nevertheless, a "litelabel" _is_ a control.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>


Hi Herfried,
a "litelabel" _is_ a control.


Not if it's the LiteLabel that I was referring to. That's a Component
<associated>with a Control.

Regrds,
Fergus

ps. Why '>' all of a sudden and no indentation? Because how could I spoil that
lovely sequence you've built up between you!

pps. Am I and Michael in the same colour? You'd better answer before Michael
otherwise he'lll get <your>colour.

Nov 20 '05 #27
* "Fergus Cooney" <fi*****@post.com> scripsit:
a "litelabel" _is_ a control.
Not if it's the LiteLabel that I was referring to. That's a Component
<associated> with a Control.


I think that's hard to decide if it is a control.
ps. Why '>' all of a sudden and no indentation? Because how could I spoil that
lovely sequence you've built up between you!
I have configured my newsserver to remove the spaces to make the text
better readable. If there is a higher level
pps. Am I and Michael in the same colour? You'd better answer
before Michael otherwise he'lll get <your> colour.


People will change color if there are multiple replies. For example,
the author of the first post (">") will be colored darkgreen, the writer
of the 2nd post (">>") will be always colored darkred etc.

Regards,
Herfried

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #28

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: nehal | last post by:
Sir, i want in my application, a form should display lables according to the data in the database means no. of lables are not decided. how can i do this ? i also want my first form should...
1
by: Jerry | last post by:
Hi again, I have two forms as controls. Both are on a main form and with a treeview I switch back and forth between the two. On the first form is a calculation. The result of this calculation...
1
by: adawi | last post by:
Hi file.aspx does not suport <Frameset> what I supose to do? Sorry, I found this topic before but it seems they where taking about something is not file.aspx, and I got confused? How I can get...
4
by: =?Utf-8?B?T2xhbg==?= | last post by:
Hi, I'm trying to dynamically remove labels from a windows form in csharp. I have a foreach loop similar to : foreach(Control c in this.Controls) { c.Dispose(); }
1
by: John | last post by:
Hi there I've got a form that when the cursor hovers over an image I update 10 labels to show different numbers. At the moment the form is redrawing each time I update one label, this means it...
1
by: zivon | last post by:
hello everyone ! I'm trying to make something like a calendar I made some lables with the same names, with another number at the end of each one. eg: d1, d2, d3, d4 now I want to loop through...
4
by: donal | last post by:
I'm using MS Access; Is there an easy way to add a "0" in front of my zip codes? I am printing address lables and the "0" is not showing up? Help!
1
by: namartajhamb | last post by:
I have one Confirm Message Box using Confirm() javascript function which display two buttons Ok and Cancel. I want to Change these buttons lables into YES/NO. how can i change lables of buttons....
0
by: Shalini Bhalla | last post by:
i want to generate lables on which records are coming from diff tables , in form of master -- detail relation ship , can you suggest me a good lable printing software which can help me in this...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.