473,387 Members | 1,463 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,387 software developers and data experts.

How to sense when a label is full?

I'm delivering a filter-on-the-fly report to my main client.

It's a report that, as part of the Open() event, opens up a little floater
screen that lets the user choose various filtering criteria and then, when the
user clicks "Apply", concocts some SQL and applies it to the report and
documents same by loading up a label in the report's header.

Only fly in the ointment is that I don't know how big the user's filter SQL will
be and I'd like to grow/shrink the label accordingly.

Brute force would be force new lines every so often, count the lines, multiply
the line count by the height of the font and resize the control accordingly.

Is there a more legant way? I know a text box can do the CanGrow/CanShrink
thing - but a text box doesn't work in this situation because it has to be
updated while the report thinks it's printing...and that doesn't seem to be
allowed.

Is there a more elegant way than counting lines?
--
PeteCresswell
Nov 12 '05 #1
2 1625
No need to count the lines Pete. See:
http://www.lebans.com/textwidth-height.htm
TextHeightWidth.zip is a replacement for the Report object's TextWidth
and TextHeight methods. It is multiline aware and can work in both
Report and Form views. Includes a sample report to show you how to
autosize individual controls with different formatting on the same line
to simulate RTF style text.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"(Pete Cresswell)" <x@y.z> wrote in message
news:9c********************************@4ax.com...
I'm delivering a filter-on-the-fly report to my main client.

It's a report that, as part of the Open() event, opens up a little floater screen that lets the user choose various filtering criteria and then, when the user clicks "Apply", concocts some SQL and applies it to the report and documents same by loading up a label in the report's header.

Only fly in the ointment is that I don't know how big the user's filter SQL will be and I'd like to grow/shrink the label accordingly.

Brute force would be force new lines every so often, count the lines, multiply the line count by the height of the font and resize the control accordingly.
Is there a more legant way? I know a text box can do the CanGrow/CanShrink thing - but a text box doesn't work in this situation because it has to be updated while the report thinks it's printing...and that doesn't seem to be allowed.

Is there a more elegant way than counting lines?
--
PeteCresswell


Nov 12 '05 #2
Pete,

Can you set the width and the height (in twips) of the label by the Len of the
caption?
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"(Pete Cresswell)" <x@y.z> wrote in message
news:9c********************************@4ax.com...
I'm delivering a filter-on-the-fly report to my main client.

It's a report that, as part of the Open() event, opens up a little floater
screen that lets the user choose various filtering criteria and then, when the
user clicks "Apply", concocts some SQL and applies it to the report and
documents same by loading up a label in the report's header.

Only fly in the ointment is that I don't know how big the user's filter SQL will be and I'd like to grow/shrink the label accordingly.

Brute force would be force new lines every so often, count the lines, multiply
the line count by the height of the font and resize the control accordingly.

Is there a more legant way? I know a text box can do the CanGrow/CanShrink
thing - but a text box doesn't work in this situation because it has to be
updated while the report thinks it's printing...and that doesn't seem to be
allowed.

Is there a more elegant way than counting lines?
--
PeteCresswell

Nov 12 '05 #3

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

Similar topics

5
by: Kathryn | last post by:
Good morning! I am having a problem with a span. I have items, of which I only want to show the first X characters on the screen. If the user prints the page, I want the entire item to print....
45
by: Debashish Chakravarty | last post by:
K&R pg.66 describes two situations when using goto makes sense. Has anyone here come across situations where using goto provided the most elegant solution. --...
2
by: Hareth | last post by:
i got the idea "form.textbox.text = label.text" from vb... i tried it in C# but it generated errors i found a diff example from :...
4
by: Richard MSL | last post by:
I have an application using WinForms under C#. I do not use the IDE, I use the command line compiler, I build my controls in my application code. The application generally works fine, except for...
12
by: Jacob Crossley | last post by:
Please tell me there is a way to prevent this annoyance ; - ) I'm into writing perfectly indented html, but the .net dev environment is being overzealous and messing up my html formatting. for...
5
by: Rich | last post by:
The following code snipet won't run if I initialize my global label array outside of a procedure - say Form_Load. If I initialize the array inside Form_Load then it works. Is there a way to...
2
by: Paul Lautman | last post by:
Hi y'all, is there anyway that I can get the <LABEL for=... data from a form in PHP. For example, if I have <label for="name">Full name</label><br> <input type="text" size="40" name="name"...
3
by: Avi G | last post by:
Hi, i work with VS 2005 and i need to know how to put the windows time(Clock) on my label that it is on the form that i will see the full time include the second as they move, and i need to know...
71
by: active | last post by:
In the main program I check to see if a certain form has been disposed. Does it make sense in that form's FormClosed event to do: Me.Dispose to make sure it is disposed the next time I check. Or...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.