Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
2.75/5 (4 votes)
See more:
for some reason this code isn't working, on the other form the label.text = "900"; and that made the form2.label = "900"; and then we converted the text in form2 to a value, and then i made it so form2's width plus the value that is in the textbox, so the form2's width should be longer, but its not!?. whats the problem with the code?

C#
private void ShortCut_Load(object sender, EventArgs e)
{
         int value = 0;
         try
         {
                  value = Convert.ToInt32(form2size.Text);
         }
         catch
         {}
         this.Size = new Size(this.Size.Width + value, 130);
}
Posted

hi,

Based on your post, i think you want to change the width attribute value of the forms. You can use Unit.Pixel() method in pixel or Unit.Percentage() method in percentage.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.unit.pixel.aspx[^]


http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.unit.percentage.aspx[^]
 
Share this answer
 
You're using form2size.Text, aren't you missing something there? Do you want to get the form's text value or the text value from a label/textbox in the form?
 
Share this answer
 
Comments
[no name] 16-May-11 2:11am    
i want what ever number form2size.text number to be added the the size of the form
Kim Togo 16-May-11 3:25am    
@systemerror121, have you tried to set a break point at "value = Convert.ToInt32..." and see what value "form2size.Text" has ?
Fabio V Silva 16-May-11 2:40am    
Yes, I understood that. My question is, where is that text in the form2size? Is it in the form title or is in a label or textbox?
[no name] 16-May-11 3:28am    
its a label, and it is located in form2
Fabio V Silva 16-May-11 3:35am    
Then you need to change form2size.Text to form2size.<label name>.Text

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900