.net

Changing the color of open form

I have an application where in the end user can change the color of the form, textboxes, labels, buttons during run time. Let us say that if a form is opened and the user has changed the form color from blue to green. To affect the color settings the existing form has to be closed and re-opened as I'm setting the form color in the Form_L...

<div> is not working in windows7 while it is working in winXP

hello every one, i have made a vb.net web application.. in this when i am runnning this in winXP it is working fine but in Windows 7 the tag is not working .... so can any one tell me what is the actual problem.... please give me the answer... thanks & regards... ...

Is List.Find<T> considered dangerous? What's a better way to do List<T>.Find(Predicate<T>)?

Dear SO, I used to think that List<T> is considered dangerous. My point is that, I think default(T) is not a safe return value! Many other people think so too Consider the following: List<int> evens = new List<int> { 0, 2, 4, 6, , 8}; var evenGreaterThan10 = evens.Find(c=> c > 10); // evenGreaterThan10 = 0 #WTF default(T) for value ...

WinDbg not telling me where my string is rooted

I am trying to track down why a string is stored so long in my application, and eating up an excessive amount of memory. I have a Windows Service which runs regularly. It reads data from a database (in the form of a DataSet) and then does some processing - all managed .NET. The Windows Service is triggered once every 5 or so minutes,...

how to deserialize this xml in Silverlight

Xml is here <?xml version="1.0" encoding="utf-8"?> <s> <Items> <b name="test" width="100"> <Items> <d x="1"/> <e width="50"/> </Items> </b> <b name="test2" width="200"> <Items> <d x="2"/> </Items> </b> </Items> </s> I'm creating those classes public class s { public s(){ Items=...

Is Java Virtual Machine provided by Sun written in Java? Is Dot Net Framework in C++ or C#?

I am talking about the major implementation platform of these platforms. ...

Question about garbage collection in .NET

Hey all, I think my question may be related to this question here but i'll ask it anyway! If I have three objects: A, B and C where A references B A references C B references C (and vice versa, cyclical) will the B->C reference cause A to not be garbage collected when it might otherwise be collected? ...

What is the best way to learn Windows ecosystem?

I spend last decade in *BSD environment (mostly Linux, some MacOS). I mostly work in Python, but also know some C, Java and Ruby and a bit of C++ and Erlang. Whole .NET idea seems to be interesting to me and C# seems to evolved in nice language. However, I am completely lost in how Windows works now. What is the best way to learn the w...

Need a C# function to get SDCard serial in .NET CF

I've seen it written in C++ which I don't know. I need a C# function that return SDCard's serial in .NET CF. Could anyone kindly help me write a function with it? ...

VB.Net 3.5 MDI Application - MDIChild forms stop opening after N memory has been used.

Hi Guys, I hope someone may be able to help! We have a pretty large VB.Net MDI application that has been converted from VB6. When it is first run up with no MDIChild forms opened it uses about 35,000K. As more and more forms are opened (but not closed) the memory usage (according to Task Manager) creeps up at approximately 4,000K per f...

At what point do Stylecop settings stop being useful and start becoming annoying?

I work in a team where we use extensive ruleset in StyleCop and I am wondering what are the thoughts on the general point where such a tool stops being useful and starts becomes annoying. We also use GhostDoc so code is riddled with XML comments which make the code much harder to read and thus review. I have no problem with XML comments ...

SsslStream and TcpClient

Hi I use TcpClient to interact with the server. Ssl stream was built on the stream received from TcpClient.GetStream(). I need to check are there some data to read. To do this I use method Socket.Poll. Everything fine with fist line, but then Poll always saids that no data available to read, although stream.Read returns a valid data. ...

Is it possible to pre-compile ASP.Net website on a stopped IIS 6 site?

I have 2 sites on IIS, one is the live site and the other is a site that is only started when there is maintenance being carried out on the live site. In a deployment scenario I STOP the live site and the START the maintenance site so that users receive a friendly message advising of the upgrade. The only issue I have is when I start u...

WCF client returns "nothing" as a response to a third party webservice

I have a 3rd party webservice (happens to be a peoplesoft EIP service) that I'm trying to call from .net. I've tried using a service reference and the old web reference to call this service and every time I call it I get a response of "nothing" back from the service. I've ran the service call through SoapUI and it works fine. I've capt...

Overriding NotifyIcon in .NET

I'm trying to override click events on NotifyIcons in .NET. The problem is the class is sealed and cannot be inherited. The functionality I'd like to attain is rather than using a context menu to control the application, I'd like to doubleclick the icon to toggle the applications mode. Is this possible? ...

Generic methods in .NET cannot have their return types inferred. Why?

Given: static TDest Gimme<TSource,TDest>(TSource source) { return default(TDest); } Why can't I do: string dest = Gimme(5); without getting the compiler error: error CS0411: The type arguments for method 'Whatever.Gimme<TSource,TDest>(TSource)' cannot be inferred from the usage. Try specifying the type arguments explicitly....

Best strategy for adding or updating a collection of related entities when using the EF4?

Let's say you have a Classroom entity with an collection of Student entities. What I usually do when creating a new Student and need to add it to the Classroom is use Classroom.Students.Add(newStudent), now when I want to update this collection I normally clear() the collection and add the students again, something like: theClassroom.St...

When creating a custom Task how to get access to the MSBuild verbosity?

In the context of creating a custom Microsoft.Build.Utilities.Task how do I get access to the MSBuild verbosity? Microsoft.Build.Utilities.Task: http://msdn.microsoft.com/en-us/library/microsoft.build.utilities.task.aspx MSBuild verbosity: http://blogs.msdn.com/b/saraford/archive/2008/10/07/did-you-know-you-can-configure-the-msbuild-ve...

Users management on remote Windows server using C# System.DirectoryServices

Hello stackoverflow, I've written a program which opens a connection to a remote Windows server in order to manage local accounts (not Active directory). The program executes the following steps: User Creation Add the user to a group Both methods use System.DirectoryServices.AccountManagement, here the two functions: public void C...

Is there any way to constrain a type parameter to EITHER a reference type OR a nullable value type?

It'd be nice if I could define a method like this: public T GetItem<T>() where T : null { if (someCondition<T>()) return someCalculation<T>(); else return null; } Then I could use this on reference types (e.g., object, string) as well as nullable value types (e.g., int?, double?): anything that can be assigned ...