|
Use TextBox.KeyDown event where you will get KeyeventArgs.
You can compare e.key ot keys enumeration.
|
|
|
|
|
I also tried this but it is not working
it is making me go mad.
thanks
|
|
|
|
|
In key down event
if (e.KeyCode == Keys.Enter)
MessageBox.Show("KeyDown : Enter Pressed");
In key press event
if (e.KeyCode == (char)Keys.Enter)
MessageBox.Show("KeyPress : Enter Pressed");
This should perfectly work.
If not at ur end, pls show ur code..
|
|
|
|
|
this is the same code that i tried and it did't work
it is ok.
i will see what i can do.
Can it be not working because i set the AcceptAction property of the frame to a certaing button?
this could be it.
i will try it.
thanks
|
|
|
|
|
ok i found it.
The problem was the one i described in the earlier post.
it is that i set the acceptButton property to a certain button of the frame
that disabled the keyDown event to know when the Enter is pressed
thanks for your replies
best regards
|
|
|
|
|
Hi,
I need to write an application that logs when a user opens/runs or activates an application in C#. Any Windows API that can handle that?
Thanks
Eka
|
|
|
|
|
I'm not sure how you would check when an applications gets focus or whatever, but you can create an array and store in it each process that is running, then check it against currently running process in a few seconds and update it, and repeat.
That would give you a log of what processes are being run. You can also probably get the window title as well.
|
|
|
|
|
Yes there is. In windows system there is something called WinEvents . Pretty much like C# events. These are system messages sent to whomever is interested in receiving them. You declare yourself interested in receiving a certain message by registering a hook to that message -aka WinEvent-.
Anyway. Here is the sum up:
Event to hook: EVENT_SYSTEM_FOREGROUND . Click here for more events[^].
Hook function: SetWinEventHook()
Click here for an example[^]
Regards
|
|
|
|
|
Having solved the original problem I have now run into more threading problems. When i fire an event in my bindable list i get the dreaded "cross-threaded operation..." error. No problem i thought, i'll cast the target to control and invoke against that, that'll work. I then discover that the target is of type CurrencyManager and does not have an invoke method.
How can i raise an event back to the currency manager on the thread that the control it is managing was created on?
Thanks Russell.
My early morning sleepy post is below
------------------------------------------------------------------------------------------------
Hi guys,
I've got a datagridview in my application which is bound to an IBindableList which i have built to implement sorting filtering etc. I've mad some changes to the events within my app to make sure that the background threads execute in the right order and now i only have blank rows in my grid. When i select a filter criteria the right number of lines are displayed in the grid but they are all empty. I've inspected the underlying collection and the data are all correct. The grid i requesting the objects from the collection when i would expect it to. I've placed breakpoints in the property get code and it seems that the grid is not requesting any data.
I would greatly appreciate any help you can give.
Thanks
Russell
-- modified at 8:50 Monday 4th December, 2006
|
|
|
|
|
Managed to answer my own question as i closed the browser.
I had moved the line of code from the form constructor into an eventhandler. I've now made it invoke the code that sets the datasource and it's looking good.
Russ
|
|
|
|
|
Hi,
I have written a Windows form that I can manually Hide or Show either using a NotifyIcon or from other methods in my code.
However whatb I cannot yet do is Hide the application window when the application is first loaded.
It always displays on the screen and has to be manually hidden by the user clicking a button. After that point it, so far, can be hidden or shown as required.
I have tried setting WindowState to minimized in the FormDesigner code however it then does not always become visible when I want.
Can anyone advise what I am doing wrong?
Thanks Andrew
|
|
|
|
|
In your form's constructor:
this.Visible = false;
Then hide/show it as you like.
Regards
|
|
|
|
|
Hi Coders;)!
I wanna use somthing for adding item to the shortcut menus in the windows explorer. but I do not find true way yet for doing this stuff.
I think IshellExtInt & IContextMenu Interfaces are usefull for this. who khow how it works?
|
|
|
|
|
Hello, I am currently trying to program conway's game of life, but I am completely clueless!!!! Can someone help please?
|
|
|
|
|
|
Thanks for the link, it's great, I already understand what it's supposed to do, but I don't know how to go about implementing it.
|
|
|
|
|
Hi all,
I am using Visual Studio 2005 to develop a form based application in C#. I have a Tree Ctrl in my form and i want that all classes should know about the current seletion in tree ctrl.
Is it possible in C# to share a variable across the classes as we do in MFC through application class. We just need to refer to Application class (theApp) and we access the variable.
How it can be done in C#.
Thanks in advance.
Gajesh Mangal
Pune(India)
|
|
|
|
|
It's possible, but you should ask yourself if you want this. It's pretty clear this is going to break your MVC design, if you're using it.
class Application<br />
{<br />
private static TreeNode selectedTreeNode;<br />
<br />
public static TreeNode SelectedTreeNode<br />
{<br />
get { return selectedTreeNode; }<br />
set { selectedTreeNode = value; }<br />
}<br />
}
Assign the node from the GUI and use it from any other class.
WM.
What about weapons of mass-construction?
"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM
|
|
|
|
|
The most common equivelant to the application class in MFC would be to create a class full of public, static properties. As there's only one application class in MFC, so too, static variables can be seen from anywhere.
A better approach is to consider when the second class needs to see inside the first one, and set up delegates to provide this communication.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi! I need to extract all the numbers from string:
-.8497E-02 .8497E-02 .0000E+00 -.8339E-01 -.5225E-02 -.1366E+02
the position and format of numbers is always the same.
|
|
|
|
|
First fragment the string in multiple string each of them containing the string representation of one number with String.SubString method or maybe more easily with String.Split(" ") as your example implies that string representation are delimited by white spaces.
To convert each string representation into a number use Double.TryParse (.NET 2.0) or Double.Parse (prior versions).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
Hi,
I love coding with a plain text editor and the command
prompt compiler. I have the framework version 1.1 with
service pack installed, and the 1.1 SDK as well.
Just wanted to know if there's anything that cannot be
done without using the IDE. Is there?
If a person is able and has the know-how, anything can
be done using the "stupid" notepad and "painful" command
prompt compiler, right?
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
Bulky Fellow wrote: Just wanted to know if there's anything that cannot be done without using the IDE.
No there isn't. You just loose some comfort in doing it.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Bulky Fellow wrote: Just wanted to know if there's anything that cannot be
done without using the IDE. Is there?
Designing a GUI quickly, I guess. But, no, at the end of the day, I doubt that there's anything you can't do, given enough time.
Bulky Fellow wrote: If a person is able and has the know-how, anything can
be done using the "stupid" notepad and "painful" command
prompt compiler, right?
I'm not sure anyone said it was stupid. If you're coding for money, it's a stupid way to write code ( it's slower, and not fair on your employer ), but if you're coding for fun, go for it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|