|
@J4amieC
thanks for your 25 customer and single solution example...
but this solution is suitable for 2,3 panel only becuase
diffrent buttons have diffrent tasks and process time so we cant fix the 500ms for every event.
anyways i am looking for more suitable solution.....
if you come to know any, let me know.
|
|
|
|
|
The 500ms had nothing to do with whatever task the button does, it had to do with stopping a quick double click operating a button which appears after the first click. It should not matter what the second button does!
Anyway your original question asked about 2 panels, and you got a solution to the question as stated. Ask the right question, and you'll get the right answer.
|
|
|
|
|
http://www.youtube.com/watch?v=bpojl4XMweo&feature=g-upl
above link will explain you my problem very clearly.
|
|
|
|
|
|
leave it then i will solve it by myself ...
|
|
|
|
|
by ignoring queued mouse events. i got my answer.
@everybody: thank you every one for your suggestions.
|
|
|
|
|
Hi,
I want to call parameterised function which is written in c++ from c# by using thread and also how will c# know or will get return value from c++ function, so that c# function will proceed further. If you have any example then let me know.
Thanks
sjs
|
|
|
|
|
You can use P/Invoke[^] to call C++ functions within a DLL.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Something like this:
[DllImport("yourdllname.dll")]
public static extern returnType FunctionName(parameterType parameter);
To call it on a thread, call BeginInvoke on a ParameterizedThreadStart instance that in turn calls your PInvoke function.
|
|
|
|
|
if I have this is VB.NET:
Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Protected Sub OnPropertyChanged(ByVal strPropertyName As String)
If Me.PropertyChangedEvent IsNot Nothing Then
RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(strPropertyName))
End If
End Sub
What is the equivalent in C#?
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
Some good examples here[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thanks for the pointers Richard. I am self-learning C# from a 20 year VB background and some of the constructs are a little confusing!
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
Andy_L_J wrote: some of the constructs are a little confusing! I found exactly the same when I started C# a couple of years ago, but perseverance seems to pay dividends.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Declaring an event is pretty simple. Have a look here: A simple code snippet to add an event[^] The code to create an event is at the top, but the rest just provides a snippet to make it simpler to create them in VS.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Thanks Griff, I now have this (and it all seems good - satisfies INotifyPropertyChanged implementation):
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(PropertyName));
}
}
Just need to test it out.
(This is pretty trivial for me in VB.NET, however I am self-learning C# and some of the constructs are still confusing.)
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
You're welcome - it's all pretty easy (I find events and delegates generally a lot simpler to work with in C# than in VB) and a lot of C# just seems clearer then VB; at least there is a clear distinction between a method call and an index!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
OriginalGriff wrote: at least there is a clear distinction between a method call and an index!
Ah, but the difference between (), [], and {} can be tricky! I keep getting "xyz is a field but being used as a method" compiler errors. It could almost be my sig at the moment lol.
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
I tend to get it the other way round "Cannot convert method group 'xxx' to non delegate type..." and have to play "hunt where I forgot to add the brackets"!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
I'm assuming this is WPF code? I say this because I have seen this exactly that sort of code.
This is different in 2 ways to 'normal' C# code:
- The method signature. There is nothing wrong with what you have, but normally (in non WPF) the EventArgs instance is passed as a parameter:
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) This is of no consequence as your code will function exactly the same, but I thought I'd mention it. - This is more important. There is a potential race condition with your null test. It is possible that
PropertyChanged could become null between the check and you calling it. I have seen this too in much WPF code, so maybe there is some internal locking or something going on behind the scenes in WPF. The normal way would be to create a copy and call the copy:
PropertyChangedEventHandler eh = PropertyChanged;
if(eh != null)
{
eh(...);
}
So, to sumarise, I would write your code like this:
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChangedEventHandler eh = PropertyChanged;
if(eh != null)
eh(this, e);
}
|
|
|
|
|
DaveyM69 wrote: if(eh != null)
eh(this, e);
Thanks Dave, I had modified similar in my code.
I must say that I am enjoying the C# curve - seems like a 'real' language.
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
I made the leap from VB / VB.Net to C# about 4 or 5 years ago. Once the initial curve has been climbed, you will find that they are really quite similar. VB is just more verbose IMO, it's a perfectly good language.
The main benefit of using C# daily for me has been when dealing with other programming and scripting languages such as C/C++, PHP, Java, CSS etc as the syntax is very similar (beyond the which makes the transition between them, when required, much simpler.
Glad you're enjoying it!
|
|
|
|
|
Hello. I am new to C# programming. I am working on creating a Payroll system. I am having trouble getting my btnSearch to connect to another form when clicked. What I am trying to do is give a user the option to search for an employee by their last name and have them directed to another web page which will display the employees information. I am not sure how to make the connection from the btnSearch to a View Personnel form. I have tried looking for some examples but have had no luck. Any help would be greatly appreciated.
Thank you!
|
|
|
|
|
What platform are you working on? (ie. Webforms or MVC?) It'll make a difference on how to approach this.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
I am using Microsoft Visual Studios 2010. They are aspx.cs files.
|
|
|
|
|
Cool.
You need to create a button click handler for the button in your code behind for the page where the button is located. In that button click handler you need to do a Response.Redirect("WhereYouWantToGo.aspx"); call to redirect to the new page.
MSDN[^] article on how to do this.
I wasn't, now I am, then I won't be anymore.
|
|
|
|