Answer Questions
>rik< How can I traverse a treeview and delete every node that deosn't have child?
Hello, I am wondering how can I traverse a treeview and delete every node that deosn't have child. Please help. Thanks. Here is a little self-explaining sample code i wrote: private void button1_Click( object sender, System.EventArgs e) { foreach ( TreeNode node in treeView1.Nodes ) { RemoveEmptyNodes( node ); } } private void RemoveEmptyNodes( TreeNode node ) { if ( node.Nodes.Count & ...Show All
Thomas S Larsen List<T>.Insert is very slow?
I have been writing a class that uses the List<T> class and noticed a huge performance decrease when using the List<T>.Insert method to insert my elements in the correct position as opposed to just adding them to the end of the list. The collection is about 200000 elements big. I tested this by creating a new project that creates a new List<int> and adds 200000. After that I add another 100000 by using the List<T>.A ...Show All
Dustyn Lightfoot trouble using delegate in WndProc
when i use delegate like this: ----------------- [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] protected override void WndProc(ref Message m) { delegate_ReplyFromDataProcess = new PrepareDelegate_ReplyFromDataProcess(ReplyFromDataProcess); delegate_ReplyFromDataProcess.BeginInvoke(m, null, null); } delegate void PrepareDelegate_ReplyFromDataProcess(Mes ...Show All
Michael V C# Equivalent of SqlDataReader.Item
I'm new to C#, moving over from VB... Is there an equivalent to VB's SqlDataReader.Item Here's what I'm trying to do: SqlCommand cmdSelectedRecord = new SqlCommand (SQLStmt,conn); SqlDataReader SelectedRecord = cmdSelectedRecord.ExecuteReader(); txtLastName.Text = SelectedRecord.Item("lname"); txtFirstName.Text = SelectedRecord.Item("fname"); SelectedRecord.Close(); Obviously I have defined my SQLStmt and conn as the connection.&nb ...Show All
Peter Griffith Thread Question!!! Possible a simple one!
Hi I wannet to understand beter the Thread and so i thought to make a example.. it worked.. but i the Windows Task Maneger my CPU start to runt from 2% to 32% (My CPU is 3.2 GHz and 1Gb Memory of RAM) This is the Code i wrote: (And i know it isn`t quite perfect public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Thread a = new Thre ...Show All
DaveAtDotNetCodeSlingers Image Transparency & Image Files
I am attempting to create a pong remake. I am using graphics i made for the images. The images are surrounded by black. I would like to make it so black in an image shows up transparent. In game speak this is called "Sprite Transparency". I would like to make it so the pictureimage control loads the images from disk instead of "binding" it to the executable. That way my players can simply replace the files with their own to create d ...Show All
Stuart Holdstock Difference between ArrayList and Hashtable
What is the major differences between ArrayList and Hashtable in terms of performance, dimensions etc You can't compare these classes, because they serve a different purpose: ArrayList is just a collection that can only be indexed with the position (integer), while Hashtable is a dictionary that stores a key/value-pair. Hi, You may find the following article on MSDN to be useful to get an in-depth ...Show All
chris1r123 Deep equivalence testing?
Hi, hope you can help. If I create a class with some properties and fields and then instantiate two objects based on this class, I need some way of testing for equivalence. Since the == operator works on reference equivalence, this will not work for me. I need to do a field-by-field/property-by-property equivalence check. Ideally, this would be a deep test, recursively looking at sub-objects too. How is the best way to achieve this ...Show All
Javier Becerril C# analog clock runs slow on some computers
Hi all, I have a problem with the System.Threading.Timer class that I am using for my clock. The clock runs faster on an Intel box than it does on an AMD box and it has nothing to do with the CPU speed. Has anyone come across this before Any suggestions would be much appreciated. Ok, I have found that it is not a cpu problem as I have another box with an AMD Duron XP 1000MHz(5x200) which runs at the correct speed. I have tried it on another co ...Show All
Stahn overriding ToString () method for enumerations in C#
Hallo I have to override the ToString () method of an enumeration. How is the syntax in C# to do that Can someone help me Thanks Franz Franz, Unfortunately it's not possible to override ToString() on a enumeration. Instead, you need to provide a helper method to do this: public static string ToString(MyEnum value) { return "This is my customized ToString():" + value.ToString(); } ...Show All
badandybad Windows Service .NET 2.0 MissingManifestResourceException
I have a simple windows service that was created in vs2005, it uses the FileSystemWatcher class to watch for directory changes, and if an error occurs it logs it to the event log. I have used the new Resources designer to define a few common errors I would like to write to the event log. Other than my machine, all clients that are testing are getting the MissingManifestResourceExcepti on that is being written to the eventlog, System.Resources.M ...Show All
Divya List<T>.Insert is very slow?
I have been writing a class that uses the List<T> class and noticed a huge performance decrease when using the List<T>.Insert method to insert my elements in the correct position as opposed to just adding them to the end of the list. The collection is about 200000 elements big. I tested this by creating a new project that creates a new List<int> and adds 200000. After that I add another 100000 by using the List<T>.A ...Show All
AvalonCoder How to do a Reverse NetBIOS lookup to get Machine Name
I am trying to identify the Machine Name of a the computer that is currently accessing my website from within the Sites Code. I have found that when the client posts it sends its IP Address. Currently I have been taking that IP address and executing: host = System.Net. Dns .GetHostEntry(IPaddress).HostName; (Basically a Ping -a) This works great as long as they have reverse lookup zones created and they are accurate which in this insta ...Show All
James.Zhang - MSFT Source Control in Visual C# Express
Dear All, Does Visual C# Express have source control feature How do I setup Many Thanks. Hi Herman, C# Express does not have source control feature. However, you can still add your solutions and projects to your chosen source control system manually (externally of Visual Studio). For more information on what the Express versions offer in comparison to Visual Studio, see: http://msdn.microsoft.co ...Show All
Jon-12345 Send e-mail by proxy
I am trying to send an e-mail via an anonymous proxy so as to mask the user's IP address in a client I am developing as part of a desktop solution. Can anyone tell me (ideally with some code samples! :-) ) how to use the System.Net.Mail with a web proxy to achieve this Many thanks. John Hmm... a bit of spam, eh A web proxy is well... a web proxy, it's not a mail server so unless that machine also has ...Show All
