About Box - Error in the autogenerated code

A

Anders Eriksson

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
 
R

Registered User

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top