|
I had the same problem and ended up using a textbox instead of a label, setting the readonly to true, no border, and textalign right.
|
|
|
|
|
Hi everbody,
How can i get system informations(cpu,ram,hdd,ip,user name...) using c#?
Also, how can i post this informations to asp.net web page?
Please help me?
Thanks...
|
|
|
|
|
|
Thanks to reply my message, this article is very good.
However, can i post this informations to asp.net web page?
Can u help me?
A lot of thanks...
|
|
|
|
|
Sure and there are many ways to do this depending on how you want to display the information.
For example you could insert a Literal control into your page and use its Text property to dynamically fill it with the information.
The following example should show the you the principle and doesn't claim to be 100% correct:
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
this.literal1.Text = "Your info";
}
</script>
<html>
<body>
<asp:Literal id="literal1" runat="server" />
</body>
</html>
www.troschuetz.de
|
|
|
|
|
Just to clarify... using C# and WMI, you'll get the information for the server, not the client.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey folks,
I really need your help here. I have built a windows form based project in C#. Now I want to prompt the user to enter a password before accessing (using the form). Can anyone give me an easy algorithm on how to code this please?
All I want to do is to have the user enter a password to give him access to the main Interface. I am not using any database ( i am still learning C#).I string info on simple files like txt and XML. Is there a way to create a password using only those type of files?
Please help....
A Newbie
|
|
|
|
|
BelMcGrady wrote:
Now I want to prompt the user to enter a password before accessing (using the form). Can anyone give me an easy algorithm on how to code this please?
MD5 Shadow Passwords[^] explains how UNIX-like operating systems handle passwords using MD5 hash values. If those hash values are stored in a text file, a XML file or a database is secondary. If you need any additional help feel free to ask again.
Best regards
Dennis
|
|
|
|
|
Thanx Dennis,
I almost thought nobody was going ot respond to this. Anyways, I went over the link you gave me. ButI got lost on it. I felt like someone who does not how to swim and jumps in the swimming pool.
I have never worked with hashed values. If you know an easy way to code that function in C#, I would really appreciate it....
Regards,
A Newbie
|
|
|
|
|
BelMcGrady wrote:
I felt like someone who does not how to swim and jumps in the swimming pool.
I see. Okay, first you might want to read the Wikipedia article Hash function[^]. You should understand what a hash value is and why it is used to store passwords. You don't necessarily need to know how the MD5 algorithm works because the MD5CryptoServiceProvider Class[^] does all the magic for you.
If you know an easy way to code that function in C#, I would really appreciate it.
You should take a look at Cryptography Simplified in Microsoft .NET[^]. There are even msi packages with code samples so this should help you to get started.
Best regards
Dennis
|
|
|
|
|
I want to build an IE toolbar in C#. I found a lot of sites but only discovered those how to build it in VC++ 6. Since it is hard to learn MFC and the C# is the mainstream, I want to build it in C#. Can someone tell me how to do it? Thx!
|
|
|
|
|
You are still going to have to learn concepts of COM Interop and P/Invoke. There are several good articles on this site that discuss items of this nature however the only one that I am aware of that does something remotely similar is Command Prompt Explorer Bar[^] which is implemented as an extension on top of the Explorer shell. Why not take a little time and learn about MFC or ATL, it certainly can't hurt you; it will just help you even if you try to implement it in C#.
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
Hi,
This seems like an easy enough question, but I can't seem to find a solution, so hopefully someone here can help me out. It should be noted that I am new to C#.
I'm trying to change the background image of my form when the user clicks a button. I'm able to do this if I use:
<br />
this.BackgroundImage = new Bitmap(@"C:\folder\folder2\image.jpg");<br />
However, I want my app to be portable, so I don't want the image stored in an outside folder. Is it possible to store the image within the app? For instance the initial background image is stored and called with:
<br />
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));<br />
I'm thinking of maybe making several "themes" for my application, and this is the first step. However, if someone can suggest a better way of doing this I'm all ears.
Thanks in advance for your help,
Chris
|
|
|
|
|
|
I was reading through a few article's not just on tcp when i noticed in a few articles people have had to swap 2 numbers of which a couple went to a ellaborate means to do so.
My question is why??? To the point of why use A,B and C when you Just need A and B
int A = 1;
int B = 2;
A = B ^ A;
B = A ^ B;
A = B ^ A;
|
|
|
|
|
A = B + A;
B = A - B;
A = B - A;
why not that instead?
|
|
|
|
|
latta wrote:
why not that instead?
Because it doesn't work, in your example A becomes -2.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Nick Parker wrote
Because it doesn't work, in your example A becomes -2.
dang
I meant
A = A - B;
for the last line.
|
|
|
|
|
I suppose if ur gonna swap numbers just a few times, it might be more efficient the way ur saying....but when maybe ur facing 1000000 swap operations, i think the overhead of creating a 3rd variable and making all operations to get the swap based on simple equalities might have the upperhand.
|
|
|
|
|
jdeakin2004 wrote:
i noticed in a few articles people have had to swap 2 numbers of which a couple went to a ellaborate means to do so.
Were the source codes in those articles actually written in C# or in C/C++? In case it was C# I'm not sure if it makes a notable difference. Your suggestion compiles to:
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldc.i4.2
IL_0003: stloc.1
IL_0004: ldloc.1
IL_0005: ldloc.0
IL_0006: xor
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldloc.1
IL_000a: xor
IL_000b: stloc.1
IL_000c: ldloc.1
IL_000d: ldloc.0
IL_000e: xor
IL_000f: stloc.0
IL_0010: ret
Whereas the simpler approach of using three variables compiles to:
IL_0000: ldc.i4.1
IL_0001: stloc.0
IL_0002: ldc.i4.2
IL_0003: stloc.1
IL_0004: ldc.i4.0
IL_0005: stloc.2
IL_0006: ldloc.0
IL_0007: stloc.2
IL_0008: ldloc.1
IL_0009: stloc.0
IL_000a: ldloc.2
IL_000b: stloc.1
IL_000c: ret
The second example is four IL opcodes shorter and doesn't need the xor operator. Altogether no really big difference and more important I'd say you still won't know which one executes faster unless you specify the native code compiler and the target platform. Personally I might prefer the solution with three variables. Somehow I find it to be more readable. Anyway, if I consider efficiency with every line of code I write I might also go back to C and inline assembler. C# and .NET are about RAD. If it isn't fast enough maybe it's the wrong tool for the job.
Best regards
Dennis
|
|
|
|
|
Hi,
I'm trying to figure out how to do file association for my application, the web doesn't seem to have very much info on this topic. Basically, my program lets the user save a file (the type i used is .drw), i did the saving using serialization. I want to let the user double-click on this file to open up the program and the selected file. I also want to associate an icon created for this file type. I know very little about the system registry, so I have no clue on how to do this. Any help greatly appreciated, thanks!
Brian
|
|
|
|
|
|
how do i send a update statement to sql in csharp i want create the statement myself and send it
chad
|
|
|
|
|
Depending on your database, check into either the SqlCommand Class[^] for SQL Server or OleDbCommand Class[^] for a database like Access. Once you have that set up properly (refer to the two links I provided) you will want to call the ExecuteNonQuery method. If you have further questions please feel free to ask.
- Nick Parker My Blog | My Articles
|
|
|
|