|
Can somebody tell me what is the benefit of using events?
Are there any performance gains? What is the point?
|
|
|
|
|
In what regard ?
There are no performance gains, there is a loss, in terms of a lookup being required to find the method to call.
The reasons are:
1/ Events in general are the model that make software like Windows possible. An event is the only way to have a button, for example, and run some code if it is clicked.
2/ If you mean delegates in general, they allow different classes to communicate, and provide things like a callback mechanism from one class to another, so for example, in my C# paint program, an instance of the tool class, which is a specific drawing tool, can fire an event to let the main code know that a drawing event has occured, and to send the details so it can be added to the event list ( the code uses a list of drawing actions to facilitate easy undo/redo ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
hi Nick. You're a C# MVP ? Will I see you in Seattle ?
This guy probably didn't read your link, he asked another question of me today, then got really rude because I gave an MSDN link that didn't include full cut and paste code for what he was trying to do.....
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Does anyone know of a control or method for creating an options dialog like that used by visual studio? Basically there's a treeview on the left side of the dialog and depending on what you select it displays the panel that's associated to that node. I tried to implement this with a tabcontrol in vs2005 but there's no way to hide the tabs at the top. Can I just override that pain event?
Thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Use a big panel with user controls inside, and just show the user control for the selected tree item.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
If you want to integrate with Visual Studio, you should check out the Visual Studio Extensibility Center/[^], there is all kinds of documentation for writing add-in's for Visual Studio there.
|
|
|
|
|
I have singleton server object that is published:
RemotingServices.Marshal(myObject, "myObj.rem");
And that object is connected to by clients:
IServerObj = RemotingServices.Connect("tcp://.../myObj.rem");
My question is, should I connect to IServerObj one time only and keep it alive until the client closes? Or is it better to connect to the IServerObj each time the client wants to communicate with it?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
I see it going both ways..
Leaving the connection open with clients that use it once in the morning and don't touch it again may not be the best choice.
Making connections as neccessary could result in a number of hits on the server depening on your clients usage.
I would probably look at keeping the connection open for a timed period then terminate it on expiration.
|
|
|
|
|
The usage is typically many messages get sent, then the user logs out. There's only brief periods when the connection is idle. However, using my "keep it always opened" technique, I've run into problems over WAN/internet where the connection gets disconnected for no apparent reason.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuality in Christianity
Judah Himango
|
|
|
|
|
Hello,
I was wondering, how do you people update you UI such as controls, menu items and tool bar buttons?
I'd like to have something like ON_UPDATE_UI in MFC, but there's nothing in .NET. Currently I've used a timer every 1/4 of a second and it seems to work ok, without using much CPU time.
I know I could use MenuPopup events (it won't work since I have toolbar buttons for menu items), SelectedIndexChanged events and so on, but I would like a general approach.
Any ideas?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
To simply refresh the form (to redraw it's self) use: this.invalidate;
Please correct me if i'm wrong on this.
|
|
|
|
|
It works as you say, but is not what I'm looking for.
I'm asking about ideas to implement an update mechanism for user interface elements (menu items, toolbar buttons, controls).
For example, you only want the Delete button enabled if an item is selected in the list view control. You could use the SelectedIndexChanged event, but that would be particular for that list view control. What I want is a generalized mechanism for doing this.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
|
From reading that page, it seems a little too complicated for a general solution for a small app, isn't it?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Luis Alonso Ramos wrote:
From reading that page, it seems a little too complicated for a general solution for a small app, isn't it?
True, it all depends on how small the app really is.
|
|
|
|
|
Does the Application.Idle event serve your purpose?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Okay, so I'm just starting to work with AJAX, and I've run into one small problem. I have a .Net dropdownlist control with an "onChange" javascript event and an "OnSelectedIndexChanged" .Net event. When the selection is changed, I am populating another dropdownlist. Everything with AJAX seems to be working. The problem is, the dropdownlist is defaulted to one value. If I select a new value, everything works. But, if I then go back and select the original value, it does not work. The reason is that because I'm not doing an actual "PostBack", the selected value never really changes. So, when I go back to select the original value, .Net does not fire the "OnSelectedIndexChanged" event. Does this make sense? If so, does anybody know how I can fix this? Or something I could try? I've been racking my brain for hours to no avail. I can post code, but I'm pretty sure that won't make much of a difference. Thanks for any help.
Ex.
DEFAULT: LISTBOX1: A LISTBOX2: A, B, C, D
CHANGE : LISTBOX1: B LISTBOX2: E, F, G, H
CHANGE : LISTBOX1: A LISTBOX2: E, F, G, H (because .Net event didn't fire)
|
|
|
|
|
You might try posting this in the ASP.NET[^] forum.
|
|
|
|
|
Hello,
Is there a way to display a full row from a dataset, using some command,
or do I have to use sort of this statement where I have to list every column I want to be displayed.
Debug.WriteLine ("Row: "+myRows[0]["ProjectID"]+","+myRows[0]["ProjectTypeID"]+","+myRows[0]["EmployeeID"]+","+myRows[0]["VersionNumber"]);
Thank you
|
|
|
|
|
You could use WriteRow
<code>void WriteRow(DataRow row)
{
string str = "Row: ";
for(int i = 0; i < row.Table.Columns.Count; i++)
str += row[i].ToString();
Debug.WriteLine(str);
} I haven't tested this code, but it should work OK. I know a StringBuilder would be more efficent, but that's left as an excerise for the reader. (You could also output column names this way.)
Good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi friends,
I'm trying to detect locking of my workstation. so far I've worked a lot on it and the result of it is as following...
protected override void WndProc(ref System.Windows.Forms.Message m)<br />
{<br />
<br />
<br />
switch(m.Msg) <br />
{<br />
case WM_WTSSESSION_CHANGE:<br />
MessageBox.Show("Entered Session Change");<br />
switch((int)m.WParam)<br />
{<br />
case WTS_CONSOLE_CONNECT:<br />
MessageBox.Show("WTS_CONSOLE_CONNECT","WM_WTSSESSION_CHANGE");<br />
break;<br />
case WTS_CONSOLE_DISCONNECT:<br />
MessageBox.Show("WTS_CONSOLE_DISCONNECT","WM_WTSSESSION_CHANGE");<br />
break;<br />
case WTS_SESSION_LOCK:<br />
MessageBox.Show("WTS_SESSION_LOCK","WM_WTSSESSION_CHANGE");<br />
break;<br />
case WTS_SESSION_UNLOCK:<br />
MessageBox.Show("WTS_SESSION_UNLOCK","WM_WTSSESSION_CHANGE"); <br />
break;<br />
default:<br />
break;<br />
}<br />
break;<br />
<br />
default:<br />
break;<br />
}<br />
base.WndProc(ref m);<br />
}
The Messages like WTS_SESSION_LOCK and etc are also defined/declared in the application, as their values are found in windows.h;
Friends, my problem is that my application is running but it is neither responding to the code written above neither is generates any errors.
Please help me solve this problem. I want my system to respond to the above written code. Do I need to change it or any suggestions????? Please reply As Soon As Possible.
Thank u very much all in advance.
|
|
|
|
|
I've read a bunch of hubbub about side-by-side versioning in .NET, but what I haven't seen so far is a "live patching" mechanism. Specifically, I work with lots of ASP.NET applications, and we've had many many cases where we've ended up having to do complete releases to change one line of code. Surely there's a better way... In the old days' we'd have some sort of binary diff program we'd run on the executable... what's the right way to go here? And what's the right way to go specific to ASP.NET, where there are a lot of runtime generated assemblies?
Ian
|
|
|
|
|
If all you change is an aspx, you can just upload that file. If you change the code, then you need to upload the dll. You don't need to upload all your aspxs, just because you changed a line of codebehind.
I'm sure a binary diff ( being just a binary process ) will work just as well in .NET as it did in C++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello,
I have the statement as indicated below, after I find the appropriate the row in my dataset, I want to duplicate this whole row, but change the values of 2 row element. How can I do that?
foreach (DataRow row in dataset.Tables["Versions"].Rows) {
if ((row["ProjectID"].ToString() == currProjID) && (row
["VersionNumber"].ToString() == currentVersion)) {
string verID = row["VersionID"].ToString();
if (row["IsProjectSetupComplete"].Equals(true)) {
WHAT GOES IN HERE?
}
}
}
Thank you.
|
|
|
|