|
I looked at the zip file which was referenced in the previous reply. It appears that the code simply creates the pipe process in MFC/C++ code which is then put into a DLL and imported into the C# program. Athough I am sure that this works, I was really looking for the C# compliment to pipe processing. Once my C# GUI process spawns my C# process, is there any way for the two to pass information back and forth. I am not very familiar with channels, threads, etc. so I don't know whether these would be my solution. Once again, any assistance/direction is greatly appreciated.
|
|
|
|
|
Hi,
I'm trying to encrypt data in a large text control on a C# windows form. Can anyone tell me how to encrypt and decrypt the data that's in just the text control? I've seen instances on how to encrypt and decrypt files, but not strings of data. I don't need any particular algorithm, but lets just say DESCryptoServiceProvider as an example.
Thanks
|
|
|
|
|
A file is just a stream, or an array of bytes. While the examples might use a FileStream , you could use a MemoryStream or even a StringReader , all from the System.IO namespace. Instead of relying on the examples, though, make sure you read the documentation to understand what's required. After all, a string is just an array of bytes, it's only handled differently. To get a string of bytes in a particular encoding, see the documentation for System.Text.Encoding in the .NET Framework SDK as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
I want to create a small simple app that will help our users with there day to day jobs. In delphi this exe app would be around say 200k to download and install. Now if I create this in C# does anyone know how large this app could be. I've heard that you need to install the .NET framwork to run these apps and this is 20MB!! Is this correct or do you just need a cut down version? Or does XP / 2000 SPx include this framework?
Any info would be helpful - thanks
|
|
|
|
|
Man, how many times does this need to be addressed?!
Any language that targets the Common Language Runtime requires the .NET Framework to be installed, yes. Java requires a JRE, VB requires a VB virtual machine, and event C/C++ requires a runtime.
This was just asked and answer earlier today and I suggest you read the comments there. One person posted a link to a site that has a pre-linker but to use this is extremely BAD! See my comments below that.
In the future, please also click "Search Comments" above because chances are that someone's asked something already.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The executable size will be about the same. Yes, end users need the .NET framework redistributable, 21MB. Many people running XP will already have it as it's included in Windows Update, and Microsoft will be including it in most of their future operating systems, including Longhorn.
The graveyards are filled with indispensible men.
|
|
|
|
|
Thanks Judah for that, do you know if Win 2003 server includes this framework and is installed by default?
Would I be correct in saying that if you get a web browser application with all the code held on the server then you only need the framework install on the server or would your clients also need this?
|
|
|
|
|
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to draw a X axis,the X and Y data are such as following:
20000101,5.9
20000102,7.5
...........
...........
...........
20031201,5.8
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.
Thanks!
|
|
|
|
|
There's plenty of examples of how to do this on CodeProject; you need only search[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is it possible to run a .NET executable without installing the .net framework ?
For example to link the framework and the application into one executable ?
|
|
|
|
|
No, to the dismay of most .NET programmers everywhere.
--
Joel Lucsy
|
|
|
|
|
joel[^] was on about this the other day, what you need is a linker of which apparently only one exists :
http://www.remotesoft.com/linker/[^]
I dont know how good it is or not but if I where you I'd get used to the fact that if you're doing .net your gonna need the user to have the runtime installed.
The smaller the mind the greater the conceit.
Aesop
|
|
|
|
|
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
you need the .NET runtime installed. You can write an installation program with VS.NET, and have it check for the runtime, and if not present it will be installed.
So in general, your installation .exe will have the .net runtime embedded, but it must be installed.
R.Bischoff
.NET, Kommst du mit?
|
|
|
|
|
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
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[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
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...
Arvinder Gill
|
|
|
|
|
I don't know if I totally understood what you want to do...
if you just want to display a message box do it this way:
At the top of your source file:
using System.Windows.Forms;
To display a message box:
MessageBox.Show("Some text for the message box", "Caption text",
MessageBoxButtons.OK, MessageBoxIcon.Error); Check the MSDN for MessageBox.Show() to see all overloads and possible parameters...
I hope I could help you...
Regards, mYkel
|
|
|
|
|
Here is an exampel:
System.Windows.Forms.MessageBox.Show("Here you write the message inside the box","Here you write the header of the messagebox ", MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
This will create a messagebox, with one OK button(MessageBoxButtons.OK), and a picture of an exclamation (MessageBoxIcon.Exclamation)
You should not declare the messagebox as a private item(I'm not even shore if it's posible)
|
|
|
|
|
using System.Windows.Forms;
................
MessageBox.Show("Your error!");
|
|
|
|
|
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
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 ..:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace CLINICINFORMATIONSYSTEM
{
/// Summary description for Password.
public class frmPassword : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Label lblUserName;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.ComponentModel.Container components = null;
public frmPassword()
{
InitializeComponent();
SqlConnection myConnection = new SqlConnection("user
id=username;" +
"password=password;server=serverurl;" +
"Trusted_Connection=yes;" +
"database=database; " +
"connection timeout=30");
try
{
myConnection.Open();
}
catch(Exception e) <problem area, error 1>
{
MessageBox.Show("Unable to connect to server. Please try again" , "Reminder" , MessageBoxButtons.RetryCancel , MessageBoxIcon.Warning); <problem area, error 4 and 5>
}
}
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>
}
else.............
..............................................................................
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!!
Thanx a million
Arvinder Gill
|
|
|
|
|