|
I suggest hashing the password, rather than storing the raw password.
Maybe others have better ideas as well?
|
|
|
|
|
I have a console application running in an infinite loop, it simply parses text files. I need to know how to detect a keypress and then determine which key was pressed. I want the program to terminate upon the pressing of the escape key. Any help would be appreciated, I've been combing the web all over and have found nothing to be helpful.
|
|
|
|
|
ConsoleKeyInfo cki = Console.ReadKey(true);
Console.WriteLine(cki.Key.ToString());
Check the ConsoleKeyInfo.Modifiers collection for the ALT, CTRL, SHIFT keys and you can compare them with the ConsoleModifiers enum.
you can use whatever loop structure you want
do
{
}
while (cki.Key != ConsoleKey.Escape);
You can simply find this information in the MSDN article for Console.ReadKey()[^]
|
|
|
|
|
This will not work. I need to be able to be able to exit at any give time upon the keypress.
|
|
|
|
|
That makes it a little tougher. Which version of .NET are you using? The Console.ReadKey() that Chris suggested is not available until 3.0, unfortunately.
Seems to me that you'll want to make frequent checks for "escape key pressed" within your infinite loop. Some pseudo-code:
while (true)
{
flag = false
get next file
open file
while (not flag)
{
read line from file
if eof
flag = true
else
{
process data from file
if escape key pressed
flag = true
}
}
close file
if flag
exit program
}
The big problem remaining is how to determine if the escape key has been pressed. If you're using 3.0 then Console.ReadKey() should do it. If not, well does it have to be the escape key? The enter key would a lot easier to detect: Console.ReadLine().
BDF
|
|
|
|
|
Iam doing my graduation project and i need to language which is better to dealing with 3d graphics , because i need to build a 3d home from 2d home ( which is drawing by user by this langauge ) and i don't which is better c# or vb.net ??? beacase i need to learn it ...
|
|
|
|
|
Do you have a C/C++/Java background? I'd recommend C#.
Otherwise, I'd say take a few days and play around with both of them and get a feel for the synax because it is different. I'd still recommend C#, but there are solutions for either language.
I've got a book by Apress called "Pro .NET 2.0 Graphics Programming using GDI+. It is pretty good and is a C# book.
Good Luck!
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
For graphics and vector manipulation? You'll tear your hair out trying to use VB.NET for such a thing. Two main reasons:
1. The C# syntax is unambiguous when you're referencing array/matrix/vector indices. In VB.NET, array access and function calls are syntactically identical.
2. Numeric manipulation. VB.NET conceals every rounding, casting, and floating point operation. It tries its best to figure out what you wanted and when precision matters, always gets it wrong unless you're very well versed in the language and know exactly when to cast and when not to.
Obviously either language WILL work for this and depending on your skill level, it may not make any difference. But like the previous poster says - if you've already got a background in C++/Java then C# will be easier to use.
The early bird who catches the worm works for someone who comes in late and owns the worm farm. -- Travis McGee
|
|
|
|
|
"
If you're a bird be an early early bird.
But if you're a worm, sleep late.
"
-- Shel Silverstien (unless I'm mistaken)
|
|
|
|
|
|
Seems to depend mostly on your background which you'll prefer.
If you have experience with javascript, C++ or Java, you'll be most comfortable with C#.
If you have primarily done nothing but VB and VB script, you'll likely choose... that's right, VB.
If you don't like to be bothered with icky things like type safety and explicit conversion and confusing things like that, you'll be most confortable with VB.
If you like using the occational array, or are interested in readable syntax, or like behavior to follow what you wrote, you'll like C#.
If you like mystical built in 'functions' that won't convert to any other language and exist only for backward compatability, you'll like VB.
If you like pretty code that's nice and easy to read, you'll like C#.
If you like blocky crap with capitalized keywords that require extra typing or letting the IDE dump large chunks of code you may not have wanted, VB's your language.
If you like having no control what-so-ever over code or comment formating, VB's for you.
If you want to be part of the future, C#'s for you.
If you want to be on the stinky end of a sinking ship, VB's what you want.
Like I said, you'll be most comfortable with whatever you're most experienced with. And for the most part, your choice won't affect your options (technically they are both capable of producing the same results). It's really just a personal choice. But I won't taint your decision with my own personal choice.
|
|
|
|
|
BoneSoft wrote: But I won't taint your decision with my own personal choice.
I was astounded by your objectivity! Got my five.
|
|
|
|
|
Eh well, it important to not take sides.
|
|
|
|
|
|
as u r still studying and. i hope that u do most of your course projects in native C or VC or in java..
so C# is more like the above
and it is more popular than vb so i suggest u to stick with c#
|
|
|
|
|
Thanks..
Iam now be very clear to use c# after thier suggestion ...
Thanks very match again..
|
|
|
|
|
Hi,
How can I connect a network printer to a user session via C#???
For example:
I want to connect "\\intranet\phaser" to my current user session and show up as a network-based printer in my local Printers and Faxes folder.
Chris
|
|
|
|
|
You should add the printer to your local
|
|
|
|
|
|
Thanks, but I got it. Here is what I did:
[DllImport("winspool.drv")]
public static extern bool AddPrinterConnection(string pName);
[DllImport("winspool.drv")]
public static extern bool SetDefaultPrinter(string printerName);
bool result = AddPrinterConnection(@"\\server\printer");
bool resultdef = SetDefaultPrinter(@"\\server\printer");
Chris
|
|
|
|
|
anychance you can explain how you managed to add a printer connection to a remote computer ?
|
|
|
|
|
Hi Chris,
Thanks for the post! It worked for me.
Just had to add namespace System.Runtime.InteropServices for DllImport i.e. using System.Runtime.InteropServices;
Thanks again.
Pallavi
|
|
|
|
|
Am getting really tired searching this.
Can somebody help me with this?
What needs to be done is the editable gridview. on
GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
dsGrid = (DataSet)Cache["MyGrid"]; [dsGrid is populated with the grid before update]
}
I want to get the newVal when it is entered into the dataset and finally update the entire dataset by passing it to a stored proc.
Am not able to find the newVal and oldVal. I have gone thru msdn and there are Ordereddictionary, oldVal, newVal, key. All of these give me null values.
If you have any other suggestion, please help. I dont want to update row by row opening connection to the db everytime.
Any good suggestion is welcome.
Thanks
|
|
|
|
|
e.RowIndex itself is returning 0
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
e.RowIndex returns 0 in this function.
Am I missing out something? Please help
|
|
|
|
|
if u r using a template column,then u can use findcontrol to get the value.
Regards
Bino
http://www.codepal.co.nr
|
|
|
|