Windows Server 2003 comes with .NET 1.1 installed. For most smaller applications, the Framework is forward compatible (larger applications have a higher chance of using obsolete functionality). So, if you built an application for .NET 1.0, there's a chance that it'll run on .NET 1.1.
I want to draw a X axis,the X and Y data are such as following:
The first row is year-month-day format,the second is the Y data.
Now my problem is how to draw the X axis using the first row.
it will be nice to you to give me a answer,or to give me a smilar sample.
Whether it's possible or not, this should not be used! It's a .NET application and requires the .NET Framework, just like Java requires the JRE, VB (pre-.NET) requires the VB virtual machine, C/C++ requres a C runtime library, Perl requires the perl runtime, etc.
Yes, this program may allow you to pre-link the necessary assemblies but you loose practically all the benefits of the framework, such as assembly redirection, certain levels of code access security (since it could only be verified at link time) which also means malicious code targeting the CLR can now wreak havoc on your machine, and much more.
It's not like you have to install the Framework every time you install a program. More and more machines are getting it as people with half a brain use Windows Update, and if you distribute on a CD then size should've be a problem. If you have the means, you can also use an installer that downloads the .NET Framework from a server if it isn't installed yet and there are many such examples here on CodeProject, such as Enhanced .NET Bootstrap Setup[^].
If you don't want to worry about all the advantages the Framework provides, then don't use it.
I know it is possible to get the extended properties of an existing file with System.Diagnostics.FileVersionInfo.GetFileVersionInfo().
But what i want is to set these properties when i create a new file.
If you're using VS.NET, fill in the assembly attributes in your AssemblyInfo.cs file. If not, use the AssemblyTitleAttribute, AssemblyCompanyAttribute, AssemblyDescriptionAttribute, AssemblyProductAttribute, AssemblyCopyrightAttribute, AssemblyVersionAttribute (I recommend for many reasons that you not use the asterisk (*) for automatic versioning because Types as defined for a particular assembly version and you can loose control of bindings quickly), and you should use an AssemblyKeyFileAttribute or AssemblyKeyNameAttribute with the path (or the container name) of a key pair you generate using sn.exe -k KeyPair.snk and use for all your products, but keep it secure. This helps with identifying your assembly, assembly binding, and more. See http://msdn.microsoft.com/netframework/?pull=/library/en-us/dnnetsec/html/strongNames.asp[^] for more reasons to sign your assembly (to give it a strong name).
All attributes above are prefixed with the assembly: declaration to attribute the assembly itself. You can find these and more attributes (like to control the file version separate from the assembly version, but make sure you understand exactly what versioning means in reference to .NET) in the System.Reflection namespace.
Thanks for the detailed info, but unfortunately this is not what i meant.
It's not for my application's executable !
My application creates several text files. And those text files needs a subject, title, comments etc.
When you mentioned System.Diagnostics.FileVersionInfo.GetFileVersionInfo you're implying the VersionInfo block of an executable. Only executables (.exe, .dll, .ocx, etc.) have VersionInfo blocks, as they are compiled and placed into the .rsrc section of a PE/COFF executable file.
What you're wanting is alternative data-streams in files on NTFS, and it isn't supported in the .NET base clas libraries. These are what Office has used for a long time and Windows 2000 added to any file (it was always supported on NTFS, but didn't have a UI to use it). For a brief but decent article about this on CodeProject, see Accessing Alternative Data-Streams of Files on an NTFS Volume[^].
i did some coding for message boxes but the result was some errors which i had no clue of what it was trying to say...can anyone teach me whats the correct way to code a message box and do i need to declare it like this
"private System.Windows.Forms.Message;" <-- i add this and i get one error
error = Invalid token ';'in class, struct or interface member declaration.
i dont add it SIX more errors come up...help me guys...
All the answers above are correct - use the MessageBox class. The Message class encapsulates a Windows Message that is recieved through a window procedure or application/system hook and is completely different. Also, you didn't even specify a member name in your statement - just a Type with an access modifier, i.e. you didn't specify WHAT you were declaring.
At any rate, you shouldn't (can't without reflection anyway) hold a reference to a MessageBox (only contains statics) and that's probably what you want anyway judging by your subject line.
Thanx for the solutions but.....i tried all three solutions....i dunno why, but i still get the same errors...tried searchin around but to no avail...couldnt find one solution at all...well this is my last resort...i hope someone can point out whats wrong whit this code ..:
private void btnOK_Click(object sender, System.EventArgs e)
if(txtPassword.Text > 10) <problem area, error 3>
MessageBox.Show("The password should not be more than TEN characters. Please check your password again", "Reminder" ,MessageBoxButtons.OK,MessageBoxIcon.Warning); <---the problem area again! <problem area, error 2>
with this i get these errors :
1 . the value 'e' is declared but never used
2 . The best overloaded method match or'System.Windows.Forms.MessageBox.Show string, string, System.Windows.Forms.MessageBoxButtons)' has some invalid arguments
3. Operator '>' cannot be applied to operands of type 'string' and 'int'
4. Argument '3': cannot convert from 'System.Windows.Forms.MessageBoxIcon' to 'System.Windows.Forms.MessageBoxButtons'
5. Argument '2': cannot convert from 'System.Windows.Forms.MessageBoxButtons' to 'string'
well im really hoping someone could point out to me whats realy wrong with this code...im nearing my deadline but this problem has delayed me by a DAY!!
This isn't a difficult problem if you'd only read the .NET Framework SDK documentation. Type MessageBox.Show in the help index and you'll see all the overloads. Most of your method calls are all wrong. The majority of your errors are because you're using the wrong parameters in the wrong order for MessageBox.Show - this is all documented in the .NET Framework SDK. "Error" 1 isn't even an error - it's a warning. If you're not going to use the exception information, then you don't need to declare an Exception variable. You can do either of the following:
You must read the documentation. Fumbling around blind won't help. Even looking at the documentation displayed in IntelliSense (the drop-down menu that appears when you're coding statements) would tell you what parameters should go where.
Also, in one line you're trying to use the > operator with a string! This doesn't work. If you want to check the length, use txtPassword.Text.Length > 10.
In many of your incorrectly called MessageBox.Show calls, you call it using specific buttons but you never compare the return with a DialogResult! What's the point? If all you're doing is displaying an error to a user, you shouldn't even define which buttons to display because "OK" is the default button. If you actually get the return value and compare it against a DialogResult enumeration, that's a different subject:
DialogResult result = MessageBox.Show("Would you like to retry?", "Prompt",
if (result == DialogResult.Yes)
// Retry code.
It's not that C# doesn't "know" this property, it's that it does not exist. C# is just one of many languages that target the CLR and uses the same assemblies in the same way as any other language can (though some language features - not class members - are not supported by all languages).
In this example you saw, either the author is wrong (like I said, the Zoom property doesn't exist) or he has created his own PrintPreviewDialog class, or he is using the PrintPreviewControl and either named it differently or hosted it in a dialog and is encapsulating the PrintPreviewControl.Zoom property. You could do the same thing.
The PrintPreviewControl does have a Zoom property but you must host this control in your own Form. One final way is to enumerate the PrintPreviewDialog.Controls property and find the PrintPreviewControl that it uses internally and then set the Zoom property on that, like so:
foreach (Control c inthis.printPreviewDialog1.Controls)
if (c is PrintPreviewControl)
((PrintPreviewControl)c).Zoom = 2.0f;
This incorrect behavior doesn't surprise me. You are, after all, accessing this control in a way that wasn't intended (otherwise it won't be exposed as a property of PrintPreviewDialog, or at least some of its properties like Zoom would). Unfortunately, there doesn't appear to be an easy way to correct this problem. When the Zoom property is changed, and event isn't even fired so you'd have to keep the values in sync yourself!
The only way I can think of is to get the ComboBox using the same enumerative code I gave you for the control, and update it when you programmatically change the Zoom. You can use ildasm.exe (the IL disassembler) that comes with the .NET Framework SDK to figure out in what Controls collection the ComboBox is added. If you can't read IL (and it wouldn't hurt to learn - it definitely can help you understand how to write more efficient code at the very least), you can use a good decompiler like .NET Reflector[^].