About Box - Error in the autogenerated code

  • Thread starter Thread starter Anders Eriksson
  • Start date Start date
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
 
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.
 
Back
Top