G
Guest
Hi, I'm trying to add the product, title and version number to my main form
with the following code. I've tried using this code in the public class
FrmMain section but I get the error thisAsm' denotes a 'field' where a
'class' was expected. Also it will not compile 'this' with the error Keyword
this is not available in the current context
Any ideas?
Thanks
Assembly thisAsm = this.GetType().Assembly;
string messageHeader = ((AssemblyProductAttribute)thisAsm.GetCustomAttributes
(typeof(AssemblyProductAttribute), false)[0]).Product +
((AssemblyTitleAttribute)thisAsm.GetCustomAttributes
(typeof(AssemblyTitleAttribute), false)[0]).Title + " V" +
Assembly.GetExecutingAssembly().GetName ().Version.Major.ToString() + "." +
Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString();
with the following code. I've tried using this code in the public class
FrmMain section but I get the error thisAsm' denotes a 'field' where a
'class' was expected. Also it will not compile 'this' with the error Keyword
this is not available in the current context
Any ideas?
Thanks
Assembly thisAsm = this.GetType().Assembly;
string messageHeader = ((AssemblyProductAttribute)thisAsm.GetCustomAttributes
(typeof(AssemblyProductAttribute), false)[0]).Product +
((AssemblyTitleAttribute)thisAsm.GetCustomAttributes
(typeof(AssemblyTitleAttribute), false)[0]).Title + " V" +
Assembly.GetExecutingAssembly().GetName ().Version.Major.ToString() + "." +
Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString();