|
imran_rafique wrote:
i refrence them but error found because they are not in their exact location?
What do u mean the exact location?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
because how will i add their refrences if i dont have or they are not available from net framework?
what to do?
if there is an error in a program that need it?
r00d0034@yahoo.com
|
|
|
|
|
if i want to add the refrence of system.diagnostic.dll
how will i add u if i dont have the file system.diagnostic.dll ?
r00d0034@yahoo.com
|
|
|
|
|
SOrry my 1st answer was a bit misleading
both those namespaces can occur in multiple dll's. They are both in mscorlib.dll and System.dll . Look there
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
if i have the hwnd of a form how to get its child hwnd ?
if i have the only hwnd of the botton then how to click it programatically because its easy to click with its object?
and how to listen a botton for action performed on it if i have only the hwnd of it?
r00d0034@yahoo.com
|
|
|
|
|
how to programatically click a button on form?
r00d0034@yahoo.com
|
|
|
|
|
Say you have a button called btnGo you simply call btnGo_Click(sender, e); , it is important to pass the two arguments.
HTH
Nick Parker
|
|
|
|
|
Nick Parker wrote:
Say you have a button called btnGo you simply call btnGo_Click(sender, e);, it is important to pass the two arguments.
Nope, that's not correct? What if there are several event liseteners? You have to use PerformClick method.
|
|
|
|
|
Rama Krishna wrote:
Nope, that's not correct? What if there are several event liseteners? You have to use PerformClick method.
There maybe other methods to do this other than the way that I described above however the follow below does work.
private void cmdSearch_Click(object sender, System.EventArgs e)
{
if(txtSearch.Text == "")
{
MessageBox.Show("Please enter a value to search on");
}
else
{
}
}
private void txtSearch_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar == 13)
{
cmdSearch_Click(sender, e);
}
}
I see that the PerformClick creates a click event, but if there are several listeners as you say you would still need a method to differentiate the target. I'm assuming this can be accomplished through either overriding the WndProc or through the usage of a delagate . What do you think, or did I misunderstand what you meant about listeners?
Nick Parker
|
|
|
|
|
We normally add Click handler's like this
cmdSearch.Click += new Eventhandler(this.cmdSearch_Click);
Now it might not be that cmdSearch_Click is the only event handlet some other class may have added it's own event handling function to the delegate chain of the Click event. If you say cmdSearch_Click it will work for one, but waht about other event handlers in the chain? Performlick does that.
|
|
|
|
|
Not trying to be a pain and curious to see what you are talking about could you show a sniplet to describe what you are talking about, just having a problem visualizing this, if it is how I think I understand it.
Nick Parker
|
|
|
|
|
Perhaps a fresh perspective is needed
When dealing with events, two things are involved. A multicast delegate (ie a delegate that when invoked runs multiple methods) and the event handlers attached to that delegate.
When one calls myButton.PerformClick() you are telling the Button to fire the Click event, this in turn invokes the multicast delegate that represents the event object. This will then run all event handlers attached to the event/delegate.
When you call myButton_Click(this, EventArgs.Empty); you are calling a method that just happens to be attached to the Click event. None of the other handlers get fired and thus the click didn't really happen to anything but that one handler.
A simple test, create a form with a button named "myButton" on it, now add the following code to the class
protected override void OnLoad(EventArgs e)
{
myButton.Click += new EventHandler(click_a);
myButton.Click += new EventHandler(click_b);
}
private void click_a(object sender, EventArgs e)
{
MessageBox.Show("In click_a");
}
private void click_b(object sender, EventArgs e)
{
MessageBox.Show("In click_b");
} Now add another button to the form and try your way of forcing a click and the PerformClick method.
Obviously you'll have to call both click_a and click_b in order to get the same effect; but what if other objects have attached themselves to the click event? You have no direct way of calling them since you don't even know who or what they are; which is why the PerformClick method was created.
Hopefully that makes it clearer for you
James
|
|
|
|
|
James T. Johnson wrote:
Hopefully that makes it clearer for you
Thanks James, it does. I would like to add that many times when you want to call a click event there is only one click event that you would want to call, not two or more(at least related when related to the same object). Why would another object attach itself (i.e. - your example with one button handling multiple events) to something that already handles an event. I guess I am not seeing the value in this ability. Thanks for the visual aid though, it did help to show Rama's point.
Nick Parker
|
|
|
|
|
Nick Parker wrote:
Why would another object attach itself (i.e. - your example with one button handling multiple events) to something that already handles an event.
It doesn't happen often, but one possiblity could be a logging application where it logs all actions taken by the user. It would have one method attached to all control's Click event so it could log the event.
Another thing to look out for would be any code the button itself performs when it is clicked. The default button doesn't do anything [that i know of], but derived classes might.
James
|
|
|
|
|
I suppose it is always nice to know there are a million ways to do even the simplest tasks.
Nick Parker
|
|
|
|
|
Button object has a PerformClick method which does that.
|
|
|
|
|
Hi,
How can I keep the mouse from leaving a form? I'm after the same behavior that you can see in the Form Designer of the Visual Studio IDE. When you click and hold the mouse in the form that you are designing and then drag the mouse a dashed box is draw but the IDE will not allow you to move out of the form.
What can I put in the MouseMove event that will keep the mouse pointer in my form?
Thanks!
|
|
|
|
|
You could create a Rectangle object that hold the dimmensions of your window and then check those positions against your cursors current position.
HTH
Nick Parker
|
|
|
|
|
Thanks, that sounds like a start but the thing that I'm not sure about is how to "reset" the mouse's X and Y when the mouse attempts to move out of the rectangle.
|
|
|
|
|
That shouldn't be a big deal. When you confirm that the user is trying to set the cursor outside of the form (the points you are evaluating), you will then just set Cursor.Position(myPoint); to the boundary edge of the form. myPoint would be defined as a Point structure.
HTH
Nick Parker
|
|
|
|
|
if i want to capture the mouse movement and its action on any control how to do it ?
r00d0034@yahoo.com
|
|
|
|
|
You can create an ArrayList of Point 's. You will need to check to check the bounds as well. There maybe several ways to tackle that.
Nick Parker
|
|
|
|
|
if u could tell in detail i would be very thank full to u because i am doing mine final project and i am doing the same work for many days but couldnt succeed yet?
r00d0034@yahoo.com
|
|
|
|
|
There are quite a few (a lot actually) of articles listed here[^] on how to use C#. If you have a question about how to do something, show your code in a new thread here and I'm sure someone will try to help. I can not do your *project* for you as I am currently too involved right now. If you do have a question I would be glad to try and help you out though.
Nick Parker
|
|
|
|
|
How to make a color on a Graphics object or a Bitmap object transparent?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|