.net

Why can't I cast e.CommandArgument as a Guid?

The following code fails at runtime Dim Id As Guid = CType(e.CommandArgument, Guid) It throws this exception System.InvalidCastException was unhandled by user code Specified cast is not valid Why can't I cast e.CommandArgument as a Guid? ...

Is it possible to get line numbers for stack traces on .Net CF 2.0 or 3.5

I have a .Net CF 2.0 application and am using log4net to log errors. I get a stack trace, but it doesn't have any line numbers. I noticed that it doesn't appear to deploy the pdb file to the device, so I tried to manually place it in the same directory as the exe. But that didn't help. ...

Design for handling both forms authentication and active directory

What design pattern should I use to handle both forms authentication and active directory? (Administrative setting will allow you to chose either one of them). From what I know, .NET membership provider only has forms right? ...

Dealing with .NET IDisposable objects

I work in C#, and I've been pretty lax about using using blocks to declare objects that implement IDisposable, which you're apparently always supposed to do. However, I don't see an easy way of knowing when I'm slipping up. Visual Studio doesn't seem to indicate this in any way (am I just missing something?). Am I just supposed to che...

How can I best handle WPF radio buttons?

I've got some RadioButtons in my XAML... <StackPanel> <RadioButton Name="RadioButton1" GroupName="Buttons" Click="ButtonsChecked" IsChecked="True">One</RadioButton> <RadioButton Name="RadioButton2" GroupName="Buttons" Click="ButtonsChecked">Two</RadioButton> <RadioButton Name="RadioButton3" GroupName="Buttons" Click="Buttons...

Install a .NET windows service without InstallUtil.exe

I have a standard .NET windows service written in C#. Can it install itself without using InstallUtil? Should I use the service installer class? How should I use it? I want to be able to call the following: MyService.exe -install and it will have the same effect as calling: InstallUtil MyService.exe ...

Multi-Parameterized Threads Efficiency

Would there a more elegant way of writing the following syntax? Thread t0 = new Thread(new ParameterizedThreadStart(doWork)); t0.Start('someVal'); t0.Join(); Thread t1 = new Thread(new ParameterizedThreadStart(doWork)); t1.Start('someDiffVal'); t1.Join(); Presuming we want to pass 20 d...

Best way to deal with users double-clicking buttons in a winforms app?

I'm working on a WinForms app and I have a user control in it. The buttons in the user control raise events up to the form to be handled by other code. One of the buttons starts some processses that will cause problems if they run simultaneously. I have logic in the code to manage the state so typically a user can't run the process if...

FLV thumbnails

I'm looking for a .NET library or command line tool that would allow me to extract thumbnails from FLV files (AVI would be nice too, but not required). Something that would allow me to extract a frame maybe 15% into the movie would suffice. If it could extract a few frames, let's say one frame per minute, and make an animated GIF out of ...

How to convert a string "yyyy-MM-ddZ" to a date time with .net?

I am having problems converting a string in the format "yyyy-MM-ddZ" using VB.net. For example I have the string "2007-10-21Z". Using CDate or TryParse it comes out to 10/20/2007 instead of 10/21/2007. I'm not understanding how the Z affects the date string so that when it is parsed it results in the day before. From what I understan...

Getting key of value of a generic Dictionary?

It's easy to get the value of a key from a .Net 2.0 generic Dictionary: Dictionary<int, string> greek = new Dictionary<int, string>(); greek.Add(1, "Alpha"); greek.Add(2, "Beta"); string secondGreek = greek[2]; // Beta But is there a simple way to get the key of a value? int[] betaKeys = greek.WhatDoIPutHere("Beta"); // expecting s...

best practice for retrieving data which meet selected conditions

Hi, I have a database table named call with columns call_time, location, emergency_type and there are three types of emergency: paramedics, police and firefighters. In the windows form I created CheckBoxes 'paramedics', 'police', 'firefighters' and I want to retrieve all table columns which meet user's selection. I created a function: ...

How to enable assembly bind failure logging (FUSION) in .NET

How to enable assembly bind failure logging (FUSION) in .NET. ...

Re-implementing an interface that another interface already inherits

I see stuff like this a lot: interface A { ... } interface B : A { ... } class C : B, A { ...} Why would you specify that C implements interface A, when B already inherits A? Does it make any semantic difference or is it just a matter of style? (One of many examples is List<T> implementing IList<T> and ICollection<T>, while IList<T> ...

How do I make a Windows Forms control readonly ?

Returning to WinForms in VS2008 after a long time.. Tinkering with a OOD problem in VS2008 Express Edition. I need some controls to be "display only" widgets. The user should not be able to change the value of these controls... the widgets are updated by a periodic update tick event. I vaguely remember there being a ReadOnly property th...

Static Finalizer

What is the right way to perform some static finallization? There is no static destructor. The AppDomain.DomainUnload event is not raised in the default domain. The AppDomain.ProcessExit event shares the total time of the three seconds (default settings) between all event handlers, so it's not really usable. ...

Browser app in high latency/low bandwidth environments

We have a typical business application with an Outlook-looking Winforms client talking to asmx webservices. We’d like to make a portion of the features available over our intranet, but the new users we need to reach - all of them - are in developing countries with dial up-type bandwidth and a lot of latency. And they all use IE 6. So ...

What causes DbDataAdapter.Fill to fill a DataSet with the incorrect number of columns?

I have a windows service connecting to a SqlServer database on the local box. This works fine most all the time. At a large customer, however, the database connectivity gets corrupted for some rare and unknown reason. When this happens, calls to DbDataAdapter.Fill return a DataSet with a different number of columns than in the select ...

What is the correct build system to use with Mono and multiple projects with dependencies, excluding MonoDevelop?

In a prior question, I asked about using xbuild to compile a solution file, only to be told it doesn't work for that. NAnt seems a little out of date. What other options are there? I need something that supports dependencies across multiple projects. ...

The best way to check if SQL CE is installed, and if so what version?

I've written a VB.NET application that uses SQL CE 3.5. I'm curious if anyone has any best practice or code to help check if A) SQL CE is installed and B) If so, what version. I searched msdn and google for anything but I didn't find anything helpful. I was poking around the registry and found this key: HKEY_LOCAL_MACHINE\SOFTWARE\...