PC Review


Reply
Thread Tools Rate Thread

About Box - Error in the autogenerated code

 
 
Anders Eriksson
Guest
Posts: n/a
 
      16th Mar 2011
When I create a new About Box form I get this code generated by the IDE

public AboutBox1()
{
InitializeComponent();
this.Text = String.Format("About {0} {0}", AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format("Version {0} {0}",
AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = AssemblyDescription;
}

Using this means that Title and labelVersion is repeated twice!

Is this just a bug which can be fixed by removing the second {0} or is
it something else that I don't understand?

// Anders
 
Reply With Quote
 
 
 
 
Registered User
Guest
Posts: n/a
 
      16th Mar 2011
On Wed, 16 Mar 2011 16:29:18 +0100, Anders Eriksson
<(E-Mail Removed)> wrote:

>When I create a new About Box form I get this code generated by the IDE
>
>public AboutBox1()
> {
> InitializeComponent();
> this.Text = String.Format("About {0} {0}", AssemblyTitle);
> this.labelProductName.Text = AssemblyProduct;
> this.labelVersion.Text = String.Format("Version {0} {0}",
>AssemblyVersion);
> this.labelCopyright.Text = AssemblyCopyright;
> this.labelCompanyName.Text = AssemblyCompany;
> this.textBoxDescription.Text = AssemblyDescription;
> }
>
>Using this means that Title and labelVersion is repeated twice!
>
>Is this just a bug which can be fixed by removing the second {0} or is
>it something else that I don't understand?
>

A little of both. In the example each {0} is a placeholder for an
object. The title and label version appear twice because there are two
place holders.

The document at
<http://msdn.microsoft.com/en-us/library/b1csw23d.aspx>
will explain it much better than I can.

regards
A.G.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VS2005 Autogenerated Code Overwrites my class code Kerry Microsoft C# .NET 1 20th Jun 2008 09:05 AM
WindowsCe & Autogenerated code alberto Microsoft C# .NET 1 4th Sep 2007 08:01 AM
Autogenerated code disappear Manekurt Microsoft VB .NET 2 7th Jun 2006 09:06 PM
Autogenerated Function Skeleton Code wwwmike@gmx.ch Microsoft ASP .NET 0 26th Apr 2006 07:33 AM
Gettingg an error in the autogenerated code in a app invoking a web service RD Microsoft VB .NET 2 14th Feb 2004 08:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:43 AM.