|
If you are handling the KeyPress event you can use the KeyPressEventArgs member KeyChar.
For example "Enter" is pressed:
if(e.KeyChar == 13)
If you are handling the KeyDown event you can use the KeyEventArgs members KeyData, KeyCode and KeyValue.
Hope it helps!
All the best,
Martin
|
|
|
|
|
Vivek is probably gonna make a password grabber and put it onto a machine in the pentagon. He will then proceed to take over the world and it will be all your fault. Thanks Martin#
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Yes, that's all included in my plan!
Because if all works well, he will remember me, and make me a the Co leader of the world! ;P
|
|
|
|
|
he he.....thats a good idea smyers .
thanks for the tips martin#.thanking you on behalf of all my team members..
This code was posted by me...
|
|
|
|
|
You are very much wellcome!
It's allways nice to hear that somebody had benefit from my tips!
|
|
|
|
|
hey....SendKeys() is not working for the windows logo key(start menu key)...there is no code for these keys in that function....any solution??
This code was posted by me...
|
|
|
|
|
Hello everyone,
I have an ASP.NET C# website that loads data (modules). This is my code below:
private void prevMod()
{
string[] stModArray = (string[])Session["modArray"];
for (int i=stModArray.Length-1; i>0; i--)
{
if (Session["selectedModule"].ToString() == stModArray[i].ToString())
{
Session["selectedModule"] = stModArray[i-1].ToString();
break;
}
}
BindData();
}
Ultimately, this button loads all the data into a string array and when you press it it moves to the previous item in the array but before I'm able to do that I get this error:
Object reference not set to an instance of an object. - for (int i=stModArray.Length-1; i>0; i--)
Does anyone have any ideas? Thanks in advance I appreciate the help
|
|
|
|
|
Have you tried stepping through the code to see what causes the error ? Is modArray always a string array ? Are the strings ever null ?
Michael101 wrote: stModArray[i].ToString(
This is kind of ridiculous, you call ToString on a string, and it could be null, which would cause your error.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What causes the error is when I try to return the length for the for loop. I know the ToString looks stupid I origionally didn't do that but I will check if a null value is getting passed in but I can't see why...... The problem is when it firstly initiates the for loop.
|
|
|
|
|
Then stModArray must be null. Have you tried setting a break point to see why it fails ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yep I've found the problem.... It is null after all..... I did a Response.Write command and it's empty. I heard there is a way of promoting people within the site, since you've helped me I'll be more than happy to do it for you. How do you do it though?
Thanks for the help
|
|
|
|
|
CG doesn't need promoting - he is generally recognised as the definitive answer is this forum. Just rate his post using the 1 2 3 4 5 at the bottom.
Regards
*********************************************
|
|
|
|
|
Thanks for the 5 Glad to help.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: you call ToString on a string
That brings back some memories.... this dude would write code like someString.ToLower().ToString() and someString = someOtherString.ToString().
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Can I use a service to control a client's service from a server
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Which service is it that you need to control and by control do you mean start and stop? Most services can be started and stopped by running the command
net stop [servicename] or net start [servicename]
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
I want to start or stop a built-in windows service through my own windows service in C# .Net
Is it possible?
if yes plz give me a reference.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
It is possible. If I remember correctly you wanted to do it over a network. Just add a handle to a Timers tick event(you can make it tick every second). Make the tick call a method that tries to accept a client and reads from the stream. If there was a connection just run the following code:
System.Diagnostics.Process pro = new System.Diagnostics.Process();
pro.StartInfo.FileName = "net";
pro.StartInfo.Arguments = "start messenger";
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.RedirectStandardOutput = true;
pro.Start();
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
How make it that the mouse Drag the formBorder invalid?
Thanks.
|
|
|
|
|
check FormBorderStyle Property of form
|
|
|
|
|
Play with the FormBorderStyle property.
|
|
|
|
|
can anyone explain clearly whether C#.net is platform independent or not? so many people saying their own style. still i am confused. TIA
|
|
|
|
|
C# is plateform independent because it's virtual machine concept.
matter of fact is this .Net Applications can be run on any plateform that supports the Virtual Machine (.Net FrameWork like JRE for Java)
|
|
|
|
|
Even with java this is not completely true. Applicatiosn always use OS functions. The OS functions mey contain bugs and quircks that makes it just a little more complicated. I know about horrible cases where two diferent applications require non-compatible runtime engines. So platform independency is always relative. The least you should do is test on each platform.
|
|
|
|
|
The answer is not simple. C# is an independantly standardised language, but rigt now, it works in the .NET framework, for Windows, and under Mono ( in Linux ), but I'm not sure how complete the Mono implimentation is.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|