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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Changing form width on loading or ... ??

Posted By:      Posted Date: October 28, 2010    Points: 0   Category :Windows Application

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

View Complete Post

More Related Resource Links

InfoPath Workflow Task Form "Loading" event handler only being called after App Pool recycled.


I have a Workflow that is using an InfoPath task form.  In the "FormEvents_Loading" method event handler I have some code that needs to run each time the form is opened.   I recycle the App Pool and open the form the code runs perfectly, but if I close and try to re-open the form the code is not run at all.  I can then recycle the App Pool again and on the next load the code executes just fine.   The code that is supposed to be run is a very simple statement to set a field value, so I don't think it is interfering.

Does anyone know what this might be?


Changing fields while updating an InfoPath Form to a SharePoint 2010 Document library

My document library has following EventReceiver: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Receivers ListTemplateId="101"> <Receiver> <Name>EventReceiverDocumentLibraryItemUpdating</Name> <Type>ItemUpdating</Type> <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly> <Class>EventHandling.EventReceiverDocumentLibrary</Class> <SequenceNumber>10000</SequenceNumber> </Receiver> </Receivers> </Elements> Updating a browser enabled InfoPath form in the document library fires following event: Public Overrides Sub ItemUpdated(ByVal properties As SPItemEventProperties) Try Me.EventFiringEnabled = False properties.ListItem("Lastname") = "Testperson" properties.ListItem.ParentList.ParentWeb.AllowUnsafeUpdates = True properties.ListItem.SystemUpdate(False) ' solution 1 properties.ListItem.Update() ' solution 2 properties.ListItem.UpdateOverwriteVersion() ' solution 3 properties.ListItem.ParentList.ParentWeb.AllowUnsafeUpdates = False Me.EventFiringEnabled = True MyBase.ItemUpdated(properties) Catch ex As Exception Me.EventFiringEnabled = True E

There has been an error while loading the form - The following file is not a valid InfoPath form tem



We’re experiencing quite an odd issue with opening forms within a SharePoint form library. These are the symptoms;

We recently published a newer version of an InfoPath form, and have since received some feedback that the form no longer opens in the “View Properties” view of SharePoint.

Rather interesting though, within the standard view all form instances can be opened with no problem.

The reason this has to work within the “View Properties” view of SharePoint is because we have a workflow that is sent, with a link to this particular page.

This is the error message that is displayed;


There has been an error while

Change form width ???


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

filling current user name in people picker field when loading form using javascript


Hello guys,

I am looking is there any way to fill the current user's name in people picker field in newform.aspx using javascript?

If you anything, please let me know 


edit form page loading is slow with more fields in foundation 2010


Hi friends,

I have recently noticed that ,my list edit form page load time is more compare to old version .

I have migrated my sharepoint site from wss3.0 to foundation 2010. I have a large list with 15,000 items and 43 fields.

My new item form is loading very quickly but edit form taking more than a minute. I tried with helath reports and firebug and yslow tools.

I didn't success with any reason. I request you to send me why it happening to the edit form page only

Out of 42 field 12 fields are lookup and I have field edit permissions enabled for different users.

Let me know what can I do to improve page load time for my list edit form.





Changing the report width.


Hi All,

I have an sql server 2008 report with two tablixes: small one and a very wide one. The report has a Yes/No parameter which I use to show/hide appropriate tablix.

Is there way to shrink the report width when a user chooses to see small tablix? 


There has been an error loading the form. MOSS 2007


Receiving this error when viewing a task with out of box approval workflow.

Here is what the Event log shows.


The form template failed to load. (User:domain\username, Form Name: Review, IP: , Request: http://siteList=d57c23fe-011b-4320-9f42-eb0ef0af92af&ID=3531&Source=http://site={9E2961B8-AAE4-4115-9A47-824DA8DCF1BF}&FilterField1=Status&FilterValue1=Not%2520Started&FilterField2=AssignedTo&FilterValue2=Kojetin%252C%2520Gayle, Form ID: urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Review:1033, Type: NullReferenceException, Exception Message: Object reference not set to an instance of an object.)


Any ideas?

Changing the column width in Transactional Replication

I changed  the column width on the publisher and all of sudden my replication failed saying unable to insert identity value.And finally I had to remove the article from the publisher.
How can I increase the column width of table without any impact  thats published as article in Transactional Replication?

Show wait form while loading another heavy form


Dear All,

I have a situation in my project that is a small and nice popup with loading animated gif should show while loading heavy forms in the application. For that to implement I have used threading concept. I am opening loading splash form in a separate thread and ending it when the main thread notifies that its task is completed. Every thing is working fine but my problem is when the user clicks on the application's forms while splash screen is doing its business the application is hanging.

Please help me on this.The code is as follows

class PleaseWait : IDisposable
        private FrmSplashWait mSplash;
        private Point mLocation;
        private string ttlTxt;

        public PleaseWait(Point location,string ttl)
            mLocation = location;
            ttlTxt = ttl;
            Thread popupthread= new Thread(new ThreadStart(workerThread));

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?





There has been an error while loading the form. A required resource could not be downloaded. To try

Actually i create site and publish some infopath files .I open the infopath form in browser enble and save to particular site.When open it in intranet it ok but when i open it i Internet it give me error as

"There has been an error while loading the form. A required resource could not be downloaded. To try to resume the download, refresh the page."

 the main thing i obserb that while opening the file in internet it redirect to intranet .so change the url according to internet url and i got errror as above .

pradipta nayak

DataGridCell Alignment Style Changing Width of Content?


It appears to when I use the following style to alter the cell alignment of a column, it is changing the width of the cell's contents to no longer expand to fill. This is problematic as it means I have to click in the narrow region shown in the second picture to edit the contents. What's the proper way to fix this?

Style code:


<Style x:Key="RightAlignStyle" TargetType="{x:Type DataGridCell}">
  <Setter Property="HorizontalAlignment" Value="Right" />


Width without Style:


Width with Style:

Loading new form from another form


I am developing an application using C#. Now I am in a serious trouble. I nned urgent help.

The application have a splash screen. It will done basic checks to run the application. I am using background worker for displaying details of background jobs in splash screen.

private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
      Form1 home = new Form1();

The problem is, Form1 closes soon after it display. I search a lot. But I didn't get correct info. Please help.

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

JQuery Validate plugin to validate a ASP.NET Form

The first time I used the JQuery Validate plugin, it did not work at all, see JQuery Validate odd behaviour with the ASP.NET Script Manager for reason, but perseverance and stubbornness prevailed and I finally created my first JQuery validated ASP.NET Forms contact form.
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