Archived Months
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008
February 2008
March 2008
April 2008


all groups > c# > march 2006 > threads for tuesday march 28

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Fast Searches of a Thread Safe Collection of Structs
Posted by Jeff S. at 3/28/2006 9:35:05 PM
In a Windows Forms application I plan to have a collection of structs - each of which contains a bunch of properties describing a person (e.g., LastName, FirstName, EmployeeID, HomeAddress, ZipCode, etc). So each instance of the struct will describe a person - and about 900 instances (people) ...more >>

Equivalent of java ">>>" operator in C#
Posted by mkalyan79 NO[at]SPAM gmail.com at 3/28/2006 9:28:25 PM
Hi, I wanted to find out what is the equivalent operator of ">>>" operator of java in C#. Thanks, K ...more >>

XML file created using XmlTextWriter
Posted by quest at 3/28/2006 9:12:07 PM
I created xml file using XmlTextWriter. When I opened the xml file using binary editor, the first 3 bytes of the xml file consist of EF, BB, BF respectively. Is there any way I can generate the XML without the mentioned 3 bytes (EF, BB, BF) ? Thanks in advance. ...more >>

Multi-threading and callbacks
Posted by Gilgamesh at 3/28/2006 7:54:46 PM
Hello, I have a main program which is supposed to loop through a datareader and then spawn a thread each time it goes through the loop. Each thread will be generating a report. Once the thread completed the report it should notify the main progam that it's done. The main program should wait u...more >>

dynamically resizing arrays
Posted by John A Grandy at 3/28/2006 7:19:10 PM
As there is no ReDim in C# , what is the preferred technique for dynmically increasing the size of any array ? Does the answer depend on whether the array holds primitives versus instances of classes ? ...more >>

why does IndexOf still return -1
Posted by Gordon Cowie at 3/28/2006 7:16:18 PM
Wouldn't it make sense if IndexOf just threw a character not found exception instead of -1? If -1 is what you were expecting there should be a function ContainsChar that returns bool. Thoughts? ...more >>

What is the best way to distinguish between TreeNodes
Posted by DrPete at 3/28/2006 6:57:02 PM
Hi People Could anyone suggest to me the best way to distinguish treenodes? By this I mean I'm in a situation where I have a TreeNode that displays a number of categories and within those nodes there are items of stock. There are a number of things I wish to do, such as use a ContextMenu to...more >>

Simple prob with events, pls help
Posted by Daniel at 3/28/2006 6:24:48 PM
I want to do something really simple. I have a form and a class which handles my network layer The form has an instance of the network class as a member and initialises the network layer. Inside the network class it then starts dealing with connections and listening (server). When a ...more >>



Regex to extract after final hyphen
Posted by John A Grandy at 3/28/2006 5:08:10 PM
How to write a Regex that extracts whatever follows the final hyphen in a string ? ...more >>

Regex replace help
Posted by Julius Fuchs at 3/28/2006 4:28:24 PM
Hi, I have a string like "bla<cut>blubb<cut>bla<cut>blubb" and want to replace the substring from the first occurrence of <cut> to the second with "TEST" in order to get "blaTESTbla<cut>blubb". So far I only managed to get blaTESTblubb: Regex iRegex = new Regex("<cut>.*<cut>"); return iR...more >>

How to I get number of item in an enum
Posted by tony at 3/28/2006 3:41:24 PM
Hello!! Is it possible to get the number of items in an enum. //Tony ...more >>

namespace System.Runtime.Remoting.Channels.Tcp is not recongized?
Posted by james.cssa NO[at]SPAM gmail.com at 3/28/2006 3:36:17 PM
When I try to compile the following program on Visual Studio 2005 Pro, the namespace System.Runtime.Remoting.Channels.Tcp is not recongized by the compiler. (The "Tcp" part is highlighted.) And I get the error message: Error 1 The type or namespace name 'Tcp' does not exist in the namespace '...more >>

Email... HELP
Posted by blini at 3/28/2006 3:27:23 PM
//create the mail message MailMessage mail =3D new MailMessage(); //set the addresses mail.From =3D new MailAddress("felipe@gmail.com"); mail.To.Add("felipe@gmail.com"); //set the content mail.Subject =3D "This is an e...more >>

Project Organization - Folders, Multiple Projects, etc
Posted by Jefffff at 3/28/2006 2:57:12 PM
I'm starting work on a new and non trivial Windows Forms application. What are some generally accepted recommendations for organizing the project folders and for breaking out different parts of the applicatoin into separate projects (i.e. multi project solution) and/or separate projects com...more >>

Namespaces
Posted by Jefffff at 3/28/2006 2:40:15 PM
What is a good rationalle for creating namespaces? Please understand that I know what they are... I'm just wondering when it would make sense to group my types into multiple namespaces. I see that Visual Studio thinks that placing files into folders means that everything in a folder should be ...more >>

Delphi Power arithmetic function in C#
Posted by Magnus at 3/28/2006 2:30:21 PM
I'm migrating an applicationf from Delphi5 to C# .net Framework 2.0, but have some problems convertingt the Power function, because it is not implemented in the framework Math library. Does anyone have some code lines how to create an own Power function? regards Magnus ...more >>

File check in/check out question
Posted by Ronald S. Cook at 3/28/2006 2:29:41 PM
I've always used Visual SourceSafe for checking in/out source code. We also used it for deliverables (e.g. functional specification document), but should we be using SharePoint for that instead? And what's happening to Visual SourceSafe.. is it going away? I'd like to understand if/how Vi...more >>

optimal load factor for small Hashtable
Posted by John A Grandy at 3/28/2006 1:39:16 PM
For a Hashtable that is expected to contain no more than 100 DictionaryEntry elements , what is the best load factor ? ( This Hashtable is a encapsulted in a class , an instance of which is cached and methods on which are called by n threads ( n is approx = 25 ) ) ...more >>

Conditional compiling
Posted by lgs.lgs at 3/28/2006 1:14:15 PM
I need to be able to support multiple versions of c#. Does the compiler define any #defines so you can tell if you are compiling for.NET 1.1 or 2.0? ...more >>

Java to C# question - Logging API and processor
Posted by Sam at 3/28/2006 11:51:20 AM
I m trying to port a a Java app to C# and have two questions. i) In Java there is a java.util.Logging package that can be used to log at different levels. Is there an equivalent in C# ? 2) There is a Runtime.getRuntime.availableProcessors() method that returns the number of available proces...more >>

Weird problem using SerialPort
Posted by Padu at 3/28/2006 11:37:27 AM
I create a System.IO.Ports.SerialPort object and start communicating with a device (a pocket pc in my case). Everything works perfectly if I don't call "Write" successively. For example the following code: //it doesn't matter if \r\n is used or not, //the problem is the same sp.Write("01...more >>

MAKING WINDOWS PROJECT RUN ON A MACHINE LACKING DOTNET FRAMEWORK
Posted by rakesh at 3/28/2006 11:20:05 AM
I want to make my windows form .exe file run on a machine lacking dotnet framework.How can I make a setup project out of it to run on all machines. ...more >>

C# 2.0 spec: generics and invalid overloads
Posted by Harold Howe at 3/28/2006 11:18:27 AM
According to the C# 2.0 draft spec, the following should not compile: class G1<U> { long F1(U u) {return 0;} // Invalid overload, G<int> would have two int F1(int i){return 1;} // members with the same signature } However, it compiles without error or warning for me. This also compil...more >>

Convert.DateTime Error in .Net 2.0
Posted by Me at 3/28/2006 11:08:40 AM
Hi all I am getting a really bizzare error on when I convert a string into a datetime: The code is : DateTime dt1 = Convert.ToDateTime("10 Sep 2005"); Console.WriteLine(dt1.Year); I have installed .Net 2.0, on xp Pro SP2. When I do the following I get an error ...more >>

enumerations as options for a custom function?
Posted by Chris at 3/28/2006 10:56:05 AM
Hi, I was hoping someone could tell me how to declare/create a function so that when I call for it programatically one of the input parameters appears as a drop down list of possible options instead of typing in the value. I believe it has to due with declaring an enumeration but not sure. ...more >>

Multitier app
Posted by helpful sql at 3/28/2006 10:51:13 AM
Hi, I am new to multitier app development. I am working on a windows app that will have business layer and data access layer components. When users log into the client app, it connects to the business layer to get a list of records that it then uses to populate a datagrid. The business la...more >>

Log design (serialization)
Posted by Padu at 3/28/2006 10:04:31 AM
Hi, I'm building a class library that uses the serial port to communicate with a custom serial bus. Two of the classes I've built ("Packet" and "SerialPort") uses an aggregated class "Log" to log their activity on a log file. Now that it is working, I'd like to refactor it so it implements...more >>

MDI Child window behavior
Posted by MartinMCU at 3/28/2006 9:36:01 AM
Hello all, I am trying to develop a Windows Forms application in Visual C#.NET 2005. I have created a FormMainMDI, which has the IsMDIContainer property set to true. I have created a second form, FormClients, which displays information about the clients in the system. This form has the foll...more >>

Include & library paths, Linker/Inputs
Posted by DrOrbit at 3/28/2006 8:24:14 AM
I'm trying to configure Visual Studio 2005 (C#) to produce a MEX DLL that will interface with MatLab. I found an online source that describes some files that I need to attach to the DLL. The source says: "...Next, you'll be setting properties of the project (right click on the project name ...more >>

Text floating in front of a window.
Posted by UJ at 3/28/2006 8:11:18 AM
I want to display a message to the user that appears to float in front of a window. I could do it with another window but there's no way to make the window itself completely transparent but still see the text. Is there any way to do this? To reiterate - I want to put text up that is over m...more >>

Localization problem
Posted by Nathan at 3/28/2006 8:04:01 AM
We have a project that contains a number of DLLs. One DLL is a library containing User Interface utilities that are used in most of our forms. As we plan to localize all our strings, we've added a project that contains only string resources. The structure in solution explorer looks like: ...more >>

Threads & Memory
Posted by ano at 3/28/2006 7:55:02 AM
I create a method that copy files from one folder to another (see the ex. code). A new thread will create every time when user click the button. The button is enable only when the copy process was finished( ThreadState = Stop ) My question is when ThreadState = Stop, the system will release...more >>

Lots of updates in a window.
Posted by UJ at 3/28/2006 7:36:47 AM
I am going to be doing lots of stuff to my window that is currently being displayed to the user. (Moving controls around, hiding some, making some visible, ....) Is there any way I can turn off the refresh while this is going on? I don't want the user to see the stuff moving around. TIA - ...more >>

The sin of Suspend()
Posted by b.fokke NO[at]SPAM gmail.com at 3/28/2006 5:48:11 AM
Hi all! I'm working on an application that due to the nature of the application is heavily concurrent. Usually, there will be between 15 and 20 threads running at the same time. However, at some times it might be necessary to pause execution of these threads. Thread.Suspend() looks like an ex...more >>

Type constraints in constructors of generic types
Posted by anders.forsgren NO[at]SPAM gmail.com at 3/28/2006 4:37:59 AM
I have a generic collection looking like this Set<T> : ICollection<T> { // Create set from existing collection. public Set(ICollection<T> objs) {/* */} // Add objects to set public void AddRange(ICollection<T> objs){ /* */ } } Now, say I want to create a set for a ge...more >>

Disable the 'ok' button - Forms application
Posted by David++ at 3/28/2006 1:53:01 AM
Dear list, I have a smartphone Forms application built using C#. When I display the Form I would like the 'ok' button which resides at the top right of the screen to be disabled, so the user cant exit the application without setting some value first. Is there any way to disable the 'ok' ...more >>

Panels and scrolling
Posted by Code Monkey at 3/28/2006 1:32:10 AM
Suppose you've got a small Win Forms project and on one of the forms, there's a panel. In this panel, you programmatically place maybe 40 controls, which will force the panel to scroll. You set the panel to AutoScroll. Compiling the project seems fine - everything scrolls as it should.....e...more >>

LPVARIANT param returned from unmanaged dll (.net Interop)
Posted by evadell NO[at]SPAM gmail.com at 3/28/2006 1:22:59 AM
Hi all. I have a c# windows forms app that uses a unmanaged dll. I need to call a function in the dll that registers a callback function. When the dll generates an event it calls my callback function. The problem is that when my callback function is called a LPVARIANT value is returned. Dependin...more >>

Const Initializer within class
Posted by WLT at 3/28/2006 12:00:00 AM
I'm keeping both a variable, and its default value in a class: class X { public const string DefaultString = "Default Value"; ... public string VarString = DefaultString; } I'm probably not up on subtleties of how 'const' is treated in C#, cause the code compiles fine, but...more >>

What is...
Posted by Jacek Jurkowski at 3/28/2006 12:00:00 AM
.... the best way to ensure folders path have "\" char at the end of a patch? f.e. c:\program files\ not c:\program files ...more >>

UPDATE into dataset but no INSERT
Posted by Jo Segers at 3/28/2006 12:00:00 AM
Hi, Is it possible to allow updates in a dataset via a datagrid but no inserts? Can somebody explain how? Thanks in advance, Jo Segers....more >>

How to reset ba gridview content
Posted by WT at 3/28/2006 12:00:00 AM
Hello, I am trying to reset the content of mainy gridviews when some line is selected. All these gridviews have viewstate enabled Using C# and asp.net, I try changing the datasource to null in the chnaged even and do a DataBind but it has no effect the content seems to stay in the viewst...more >>

namespace DLL problem
Posted by Steph at 3/28/2006 12:00:00 AM
hello, i compil my c# program into a DLL. next i install it into my framework directory : c:/windows/Microsoft.NET/myframework.../MyDll.dll but... when i want use it with "unsing MyDll.dll" i obtain this error : CS0246: The type or namespace name 'MyDll' could not be found (are you missing a...more >>

Get this compile error "Could not copy temporary files to the output directory."
Posted by tony at 3/28/2006 12:00:00 AM
Hello! When I build an exe file that use 6 class library dll I get this error. Could not copy temporary files to the output directory. The file 'MeltPracStorage.dll' cannot be copied to the run directory. Det går inte att komma åt filen eftersom den används av en annan process. All six pr...more >>

ComboxBox Selection
Posted by Ian Semmel at 3/28/2006 12:00:00 AM
If I have a table with say Id (key) and Desc, and a ComboBox box.DataSource = table; box.ValueMember = table.IDColumn.ColumnName; box.DisplayMember = table.DescColumn.ColumnName; and the box has Sorted = true (ie sort on Desc) then when an item is selected, how do I tie the selected item b...more >>

C# and MSN
Posted by Jason Huang at 3/28/2006 12:00:00 AM
Hi, It comes to my mind last night that since I am using the MSN from time to time. Is it possible to write a small C# program so that the Messenger will respond some word or picture given that I don't respond within some time interval like 10 seconds? Thanks for help. Jason ...more >>

Global Variables
Posted by Materialised at 3/28/2006 12:00:00 AM
Hi All, I am trying the follow the following MSDN tutorial: Walkthrough: Authoring a Simple Multithreaded Component with Visual C# (ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxmclicc/html/7bc03b7b-d680-499b-8179-5f414b2d650c.htm) The tutorial says: To create the...more >>


DevelopmentNow Blog