.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Change form width ???

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :Windows Application

With this code I can change the width of a panel til the width of the form - the useable part of the form !

  public partial class Form1 : Form
    public Form1()

    private void Form1_Load(object sender, EventArgs e)
      Panel aPanel = new Panel();
      aPanel.BorderStyle = BorderStyle.FixedSingle;
      aPanel.Width = ClientSize.Width;

How can I do it the other way around = set the form width to the width of a panel ?

It seems like the ClientSize.Width is READ ONLY !

I can use

this.Width = aPanel.Width + 8;

but what is this spooky 8 ????


Best regards KSor, Denmark

View Complete Post

More Related Resource Links

How do you change the width of a multiple line of text box on a custom list form?




I have a custom list that has been added using SharePoint Designer to a web part page as a custom list form (Insert - SharePoint controls.)

The list has many single lines of text and one multiple line of text.

The multiple line of text is too wide - I need to make it narrower but how?





change form target from javascript


Salam to all,

in my page, i have an iframe which have a src for another page,

the inner page have a Forms, buttons.. ..etc. the target for the form in the inner page is "self"

i need to run a javascript code from the parent page to change the  inner page form target to posted the values in a Blank window.

how can i do that ?


Change Text of Sharepoint Form Dialog title Bar

Hi, I am having Sharepoint 2010 RTM Trial on Windows Server 2008 SP2. I have published custom infopath form to sharepoint List. I have two views in that form, One is called AddItem and The other one is called EditItem. I have use the infopath rule to switch views depending on some condition and it is working fine. But when the view is switched to EditItem, I want to Customize the Title bar of Form Dialog to my custom text.... Can anybody have an answer ? Regards

How to change the size (width) of scorecard columns in Dashboard Designer?

Is there any way to change the size (width) of scorecard columns in Dashboard Designer?

how to change the web application Database connection form Windows authentication to SQL Server acco

Hi, I have a web application created and Database connection authentication was given as Windows authentication. how can i change it to a SQL server account in MOSS 2007. Thanks in advance.

How to change a Left Navigation width in sharepoint

Hello,   Any body help me out how to change or modify the width of left navigation..   thank you  

how to change button backcolor property on a form from a class file


Hello friends,

I am having a problem of updating the main form button backcolor property from another class. I have attahced the code. Please tell how can i rectify this problem.

PopUp is another class, in which i want that when ToolStripDropDown closes it change the form button BackColor from Orange to WhiteSmoke.


public partial class PopUp : ToolStripDropDown


        public PopUp()





        protected override void OnClosed(ToolStripDropDownClosedEventArgs e)


               Form1 f1 = new Form1();

              // f1._pushed = false;

       f1.Controls["button1"].BackColor = Color.WhiteSmoke;





It seems that this line works, i checked it using MessageBox it changes the backcolor property but it does not updated to the form displayed on the screen. 

Can anyone help me

Change dimensions of image if width exceeds certain amount


(In a different post  I asked about how to access an Image control held in a FormView template. This topic has been mixed into it, so I thought I would start a fresh post only about this problem.)

I would like to perform a simple check to ascertain the width of an image. If it exceeds a certain dimension I would like to give the image a width property. I understand this doesn't not affect file size, just dimensions, but it is for presentation purposes. I'm still learning VB, but the code below is what I have tried so far:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim LargeImage As Image = DirectCast(FormView1.FindControl("Image1"), Image)

        Dim Width As Integer
        Width = LargeImage.Width.Value

        If Width > 560 Then
            LargeImage.Width = Unit.Pixel(560)
        End If

    End Sub


Thanks in advance,


login form change ASPNETDB.mdf


Hi guys.

i have a database with username and passwords. Can anyone please help me showing how can i make the login form point to my database and do not create a new ASPNETDB.mdf file???I am thinking about using a web service to check if the user is present (is that a good idea??).

Change Site.Master width in CSS


Hi, I'm all new to ASP.NET but not to CSS/HTML.

I created a new WebApplication in Visual Studio 2010. In the CSS document (Site.css) it says:

    width: 960px;
    background-color: #fff;
    margin: 20px auto 0px auto;
    border: 1px solid #496077;

And the first div tag in the Site.Master file is:

<div class="page">

If I change that 960px to 400px for instance, it does not change the width of my document. Even if I write 0px it does not "recognize" the change.


Ho to Change the Search Form text



Is there any way I can change the text in the search form in SharePoint 2010?

It now says "Search this site..." and I would like to change that to a my custom text.



Change the width of the TextBox at runtime depending on it's MaxLength


I know the MaxLength of the TextBox and depending on that I want to change width of the textbox at runtime.

RoundedCornersExtenders, change border width?


Is it possible, either through layout tricks, or modifying the roundedCorners.js file, to change the default border width of the roundedCornersExtender?  I would like to make the border a little thicker than the default 1px width.

I have read a few people who have tried to do this but no one could seem to come up with anything, and most of the posts were several years old, so I wanted to check back and see if anyone knows if this is possible?

Thanks in advance!

Change value of a form field using Workflow


Hi, is there any way that I could change the value of a Form item(like textbox) designed in InfoPath 2010 using workflow conditions,

I dont want to acheive this by using rules by setting fields value,

My requirement is that on the click of a button in a form i want to run workflow which checks some conditions in the SharePoint List and I want to dispaly a message in a form,

Change e-mail for form-based user


Hi, all.

I create some users with wrong e-mail, some without e-mail. When I need to give them true email address I encountered a problem: i can't do this.

I trying to change email in sql base aspnetdb, wss_content_webapp, then restart sql, restart IIS, restart server - nothing helps me.

I tried to go to user - my settings - change and didn't see e-mail form to change.

I don't need MySite collection.

Question is - how i can change all information of user when user already exist. When i create user with writing same information - all information picking up.

Changing form width on loading or ... ??


I have a form for showing short messages to the user while program is running.

I want the form width to fit to the length of the message + some left/right margins.

I set the changing in the Form_Load with this code:

    private void formShortMessageForm_Load(object sender, EventArgs e)
      timer1.Interval = (int)tid;
      timer1.Enabled = true;
      const int margin = 50;
      this.Width = margin + label1.Text.Length * 6 + margin;

 but it don't work - the width does NOT change on the screen - where should I put the "changing-lines" so they do the job = changing the width on the screen ?

Best regards KSor, Denmark

How to change a text color in window form button!



I got an Export button in the form. I like the button text color that change from original black to white when I press it. I can change the background color of the button, but I am not sure how to change the Export text color to white. Please help. Thanks in advance.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend