|
Basically, an event handler is just a function with specific parameters.
The thing that makes an event handler different, is when it's actually hooked up to an event on an object.
So, your node_AfterCheck is a function that isn't hooked up to anything.
Typically, the event handler is prefixed with the object's name.
To hook this up to a treeview called treeView1, do this:
this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
The easier way of doing this, is to double click the event you want in the object's properties window. This will automatically create the delegate assigning code as well as the stub method code.
Hope this helps.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|
|
Thanks that worked.
I put the line in the Form1 constructor. is there a better place to put
it?
also i first tried to take your advice:
The easier way of doing this, is to double click the event you want in the object's properties window. This will automatically create the delegate assigning code as well as the stub method code.
when i look at the the object's properties window (TreeView)
there is no event for AfterCheck. i couldn't find any events to select at all.
i see DataBindings,DynamicProperties,Name, AccessibleDescription...etc.
When i double click the object i get tvMenu_AfterSelect event
What am i missing?
TIA
|
|
|
|
|
In the design view of a form, double clicking an object will create the stub code for a default event that MS had in mind for the control.
eg: if you double click a form, the myForm_Load() event will be created for you.
When looking at the properties window for a treeview (in C#) select the small lightning bolt icon just below the object dropdown box at the top.
This switches the properties window into a "event listing" for the selected object.
Now you should be able to see the "AfterCheck" event under the behavior heading.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|
|
ahhh, a good dose of ego deflation.
Thanks!
|
|
|
|
|
Hi,
My application loads two assemblies. Now I want to transfer messages between the two loaded assemblies? Is it possible?
Cheers
CNU
|
|
|
|
|
Hi,
I am writing a Windows application using C#, in which I have to copy some files to the local web server's home directory (for ex. c:\inetput\wwwroot or something else). How can I find out the the local web server's home directory? Or is there any other work around?
Cheers
CNU
|
|
|
|
|
Open the IIS management console (Administrative Tools --> Internet Information Services) and select the website you want the root folder of (on Windows XP there is only the default website). Right-click the website, select properties from the menu. In the dialog select Home Directory, the information you want is on that tab.
Do you want to know more?
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Thanks for the reply.
But I want to know the value of the Home Directory programmatically..
Is it possible?
Cheers
CNU
|
|
|
|
|
Okay, I didn't realise you meant programmatically. I thought you wanted to know where to copy your application to.
Cnu wrote:
How can I find out the the local web server's home directory? Or is there any other work around?
I would set the information in the config file of the application because the server editions of Windows can host many websites and therefore have many home directories.
Do you want to know more?
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Hello there, does anyone know where I can find an example of a checkers program written in c# ??
Thanks!!!!
|
|
|
|
|
I did a Google and found this.
I haven't downloaded it and don't know if it's complete / a good reference, but it does say that source is included.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|
|
Heey thanks a lot, before I asked I did a google search but under c# not under c-sharp
Thanks a lot
|
|
|
|
|
As title,
I have some existing incoming email and would like to put them to the inbox of outlook. Can I? What is the code?
Thanks
|
|
|
|
|
Hi,
Q1: How can I transfer an SQL database manually? I have a database which is named mydb, I looked at the harddrive and found it on "C:\Program Files\Microsoft SQL Server\MSSQL\Data" there is 2 file one of them is mydb.mdf and the lof file of that. I copied these on another machine on the same path but couldn't make it to work???
Q2: I used the below code to EMPTY a table which is named people but it is not working???:
SqlConnection mySqlConnection4 = new SqlConnection("Initial Catalog=mydb;Data Source=" + comboBox1.SelectedItem.ToString() + ";Integrated Security=SSPI;");
mySqlConnection4.Open();
SqlCommand mySqlCommand4 = mySqlConnection4.CreateCommand();
SqlTransaction myTrans;
myTrans = mySqlConnection4.BeginTransaction(IsolationLevel.ReadCommitted,"SampleTransaction");
mySqlCommand4.Connection = mySqlConnection4;
mySqlCommand4.Transaction = myTrans;
mySqlCommand4.CommandText = "EMPTY people" ;
//mySqlCommand4.ExecuteNonQuery();
myTrans.Commit();
mySqlConnection4.Close();
Anyway What is the problem???
Any help would be greatly appreciated...
Cem Louis
|
|
|
|
|
Q1: What was the error message when you tried to attach it to the SQL Server on the other machine?
Q2: At a quick glance the line with the ExecuteNonQuery() is commented out. Also, I cannot find the EMPTY keywork in the Transact-SQL reference. Are you sure you are using the right command? I would have used DELETE.
Do you want to know more?
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
i'm trying to have a particular picture fade in and out on my form. so the simplest way i thought to achieve this would be to embed another form on my mainform, add a picturebox to that embedded form, and fade that embedded form in and out by incrementing/decrementing the opacity on that embedded form. problem is, changing the opacity on that embedded form does nothing. anyone know why? is there something i need to do differently when changing opacity with embedded forms? is there any easier way i can accomplish this? perhaps just inc/dec the alpha values on the image itself? will that work?
any suggestions/help appreciated!
|
|
|
|
|
|
i don't think having 2 forms is a good idea.
maybe you can set the Alpha property of the image by defining System.Drawing.Imaging.ColorMatrix something like:
float[][] matrixItems ={
new float[] {1, 0, 0, 0, 0},
new float[] {0, 1, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, xxxf, 0},
new float[] {0, 0, 0, 0, 1}};
System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix(matrixItems);
where xxx is the desired alpha value. its a float between 0 and 1. Now create an image attrbute:
System.Drawing.Imaging.ImageAttributes imageAtt = new System.Drawing.Imaging.ImageAttributes();
Finally, draw the image using the DrawImage function of a Graphics object you have created from your pictureBox, panel, etc. to which you pass the ImageAttributes object you've just created
there are no facts, only interpretations
|
|
|
|
|
So, I get a type and I want to check to make sure it supports +, say, and then use it. But operators don't show up for Type.GetMembers() or for Type.FidMembers() or for Type.InvokeMembers(), at least as far as I can tell (and I did make sure I was looking for STATIC members), unless I am doing something wrong. So how do I get at these elusive operators?
"In a mad world, only the mad are sane."
|
|
|
|
|
This works for me.... The following is the operator code.
class TestClass
{
public static TestClass operator ++(TestClass tc)
{
// do work here
return tc;
}
}
The following is the reflection code....
TestClass tc = new TestClass();
MethodInfo[] methods = tc.GetType().GetMethods(BindingFlags.Public | BindingFlags.Static);
this way also works...
TestClass tc = new TestClass();
MemberInfo[] members = tc.GetType().GetMembers(BindingFlags.Public | BindingFlags.Static);
|
|
|
|
|
Ah, indeed. Yeah, I was doing basically that. The difference was I was doing it in general, and passing in a primitve, for which it evidently does not find operators. Not sure how to get around that problem.
|
|
|
|
|
So apparently with primitives the operators are completely built in. This would make sense, since they are in every other language, but somehow one assumes everything will work the same way as the in C#.
So, I suppose I can just check if the object is a primitve that would support the operation I want in addition to checking the supported methods. I looove special cases
"In a mad world, only the mad are sane."
|
|
|
|
|
ok i know i can use the method below to find a record using a prime key how do i search on a key that is not a prime key i am useing both sql and foxpro databases
conn.Open();
string search="someString";
OleDbDataAdapter da = new OleDbDataAdapter("select * from test",conn);
DataSet ds = new DataSet("test");
da.FillSchema(ds,System.Data.SchemaType.Source,"test");
da.Fill(ds,"test");
DataRow current;
current=ds.Tables["test"].Rows.Find(search.ToUpper().Trim());
if(current != null)
{
}
da=null;
ds=null;
current=null;
conn.Close();
thanks
chad
|
|
|
|
|
AFAIK you can only use the Find* method on PKs. You can however try using the DataView and using a RowFilter
|
|
|
|
|
I'm creating a custom program that's going to be used to run a "presentation station". The presentation station should enable the user to supply photos from any camera.
I need to replace the windows camera wizard with my own wizard. I'm going to provide some of the functionality of the original one, and a more elegant UI.
How would I approach this? Would Windows Image Acquistion Automation Layer do the job?
A few details. I need to be able to do the following...
- Most importantly - automatically start my wizard when camera is detected. (i would like the scanner to be ignored if possible)
- Transfer images to computer
- Delete image on camera
- Get thumbnails is optional - can be accomplished by getting full images and creating thumbnails manually
|
|
|
|