473,398 Members | 2,389 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,398 software developers and data experts.

Setting form size

A couple of questions

I have a progress form, if the form user wants to display an extra line of
text then they call the following

{
frmProgress f = new frmProgress();

f.SetLabel("Hello");

f.ShowDialog();

}

In the form code, I have the following function

public void SetLabel(string Info)

{

label1.Text = Info;

this.Height = this.Height + label1.Height;

//this.Height = 144;

}

form borderstyle is set to FixedDialog.

If I step into the code, this.Height is set to 117 but the visual form
doesn't get taller.

If I use the this.Height = 144 then the visual form does get taller.

Why?


Nov 16 '05 #1
3 2021
Claire,

That code doesn't look right to me. If you call SetLabel more than
once, then your form will grow and grow, even though you are replacing the
label text, and not appending to it.

My guess is that it has something to do with the BorderStyle, and that
you might be setting it to a smaller value than what it initially is. Can
you post the code?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Claire" <as*******@ntlworld.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
A couple of questions

I have a progress form, if the form user wants to display an extra line of
text then they call the following

{
frmProgress f = new frmProgress();

f.SetLabel("Hello");

f.ShowDialog();

}

In the form code, I have the following function

public void SetLabel(string Info)

{

label1.Text = Info;

this.Height = this.Height + label1.Height;

//this.Height = 144;

}

form borderstyle is set to FixedDialog.

If I step into the code, this.Height is set to 117 but the visual form
doesn't get taller.

If I use the this.Height = 144 then the visual form does get taller.

Why?

Nov 16 '05 #2
Hi Claire,

Can you post working example of this problem?

--

Stoitcho Goutsev (100) [C# MVP]
"Claire" <as*******@ntlworld.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
A couple of questions

I have a progress form, if the form user wants to display an extra line of
text then they call the following

{
frmProgress f = new frmProgress();

f.SetLabel("Hello");

f.ShowDialog();

}

In the form code, I have the following function

public void SetLabel(string Info)

{

label1.Text = Info;

this.Height = this.Height + label1.Height;

//this.Height = 144;

}

form borderstyle is set to FixedDialog.

If I step into the code, this.Height is set to 117 but the visual form
doesn't get taller.

If I use the this.Height = 144 then the visual form does get taller.

Why?

Nov 16 '05 #3
The following code works

public void SetLabel(string Info)

{

label1.Text = Info;

Height = 144;

}

The following code doesn't work.

int OriginalHeight = 0;

public frmProgress()

{

InitializeComponent();

// Height is 101 when fn called

OriginalHeight = Height;

}

public void SetLabel(string Info)

{

label1.Text = Info;

Height = OriginalHeight + label1.Height;

}
Nov 16 '05 #4

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

Similar topics

21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
9
by: netclectic | last post by:
I'm dynamically adding options to a select list in javascript and i need to be able to set the height of the option, but setting style.height has not effect, I also tried style.pixelHeight but no...
1
by: Colin Ward | last post by:
Hi. I have a popup modal form which gets part of its caption from code. The part of the caption which is determined from code is the name of the event. For example the caption would be "Add Year...
2
by: Paresh Dhakan | last post by:
Hi ! I am facing a wierd problem in setting the width of a form to 20. Suppose I create two forms Form1 and Form2. Form1 is the container, meaning this.IsMdiContainer = true; Form2 is...
1
by: G Uljee | last post by:
Hi all, I've some difficulties with the screen/form locations. When I fist set my location of the form and then the execute the show command the form is located at...
0
by: Stuart Norris | last post by:
Dear Group, I am having a problem setting SocketOptionName.SendTimeout on a client TCPIP application using the sockets in .NET. From the on-line help it is possible to set a...
1
by: Rachel Suddeth | last post by:
I have an form where the whole display is a tab control (well, that plus a status bar.) I want to set the focus to the first TextBox on the first TabPage when it loads. I tried to put that into...
1
by: DBC User | last post by:
I came across the application setting feature today and it is pretty cool. I would like to know if someone can help me in the following situation. In my current project, On form closing I take the...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
8
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.