.net

Programmatic way to get all the available languages (in satellite assemblies)

I'm designing a multilingual application using .resx files. I have a few files like GlobalStrings.resx, GlobalStrings.es.resx, GlobalStrings.en.resx, etc. When I want to use this, I just need to set Thread.CurrentThread.CurrentCulture. The problem: I have a combobox with all the available languages, but I'm loading this manually: comb...

Media Player

How to embed a Jukebox or a media player in C# .NET? Or rather create a playlist which can play WAV files. ...

Using a C# class library as a COM+ server application

I created a .NET class library in C# and exposed it to COM. It works fine as an in-proc COM server. However I want to use it as an out-proc COM server to have it in a separate process. To do so I try to create a COM+ application. I created an empty COM+ application and added the classes implemented in the class library into it. When I c...

What's the equivalent of MdiWindowListItem when using a DockPanelWorkspace?

We have a composite application with a DockPanelWorkspace as its main user interface area. Above this sits a MenuStrip with a window menu set as its MdiWindowListItem. Unfortunately, as I feared, the window menu isn't populated with the open views. Is there an equivalent in CAB that will populate a menu with a list of the open views i...

string1 >= string2 not implemented in Linq to SQL, any workarround?

Hi, anyones knows how to do this? Edit: I am trying to do >=. I correct the Title. ...

Mutual exclusion: is this safe?

Is this pattern for mutual exclusion as safe as I think it is? If so, what do you call it? lock (_lock) { if (_flag) return; else _flag = true; } try { //critical code... } finally { _flag = false; } I want to ensure the critical section, but without the other threads piling up waiting to acquire the lock. Obviously I ...

Winforms Style / UI Look and Feel Tips

Coming from many years of asp.net development back to a winforms application. Looking for advice and tips on how to "style" winforms similar to how I would do with CSS/Master Pages in asp.net. I am interested on how to update font/colors for certain types of controls in one place. How to maintain consistency for layouts. Any pointe...

LINQ Query skips without exception. Why?

I have a method that gets a nested array as parameter: Number[][] data where Number is my very simple class that inherits from INotifyPropertyChange. And then i have a statement like this: double[] max = (double[])data.Select(crArray => crArray.Select( cr => cr.ValueNorm ).Max()); When I'm trying to watch it in the debugger it jus...

Naming Convention for State / Region / Province

I am building a class that represents a US State or Canadian Province. What should the class be called? Some ideas: Region: Problem with this is that .Net has a RegionInfo class that uses the term Region to represent a country (and not a State or Province). State: Problem with this is that it could cause confusion with Application St...

Can't write string in exception constructor

Visual Studio seems to complain when I pass a string into an exception parameter. if (str1 == null || str2 == null) { throw new ArgumentNullException("lmkl"); } Visual Studio says that it cannot resolve symbol "lmkl". If I have a string variable (eg above throw new... string s = "test";) and include this as the parameter for the ...

Can a .NET Word 2003 add-in be installed outside of the GAC?

I've created a Word add-in component, and a visual studio setup project to install the component. On a clean machine with Office 2003 installed, it does not seem to be possible to get the add-in component to load in Word. Googling the issue suggests that this is because the assembly is not trusted. I gave the assembly full trust using ...

Serializing an array of integers using XmlSerializer

I'm encountering a problem while trying to serialize a multi-dimensioned array of integers via XmlSerializer for an XNA project I'm working on. I'm able to serialize all of my other data (booleans, strings, even Colors, etc) without a hitch. I've also seen plenty of people claim that XmlSerializer will natively handle (single-dimension...

intercepting keypresses even when the form does not have focus

I've built a winforms application which checks for CTR+ALT+S and CTRL+ALT+E keypresses, using by overriding the ProcessCmdKey method. This works great, but if the screensaver goes on and then goes off the form doesn't have focus and the keypresses aren't intercepted. How can I receive these even if the form does not have focus? ...

Save a custom int value for each User in a .NET Web application

Hi everyone! I'm new to developing web applications using the .NET framework. I'm just wondering if .NET has any support for saving a custom int value for each (logged in) user? Could I perhaps use the HttpContext.User property or something? I'd be really grateful for some help on this! /Ylva ...

Debugging the Interwoven Worksite Web Services

EDIT: Web Services being called from a windows console application at present, using VB.Net and Visual Studio 2008 We are using the Interwoven Worksite Web Services and are having issues debugging them. The web service is returning the following error: "Unable to access the object. It may have been deleted or you may not have sec...

Entity framework and many to many queries unusable?

I'm trying EF out and I do a lot of filtering based on many to many relationships. For instance I have persons, locations and a personlocation table to link the two. I also have a role and personrole table. EDIT: Tables: Person (personid, name) Personlocation (personid, locationid) Location (locationid, description) Personrole (per...

How to get the actual size-on-disk of a file from PowerShell?

Hello: I am writing an administrative script, and I need to calculate the size of files on disk. These files are on a compressed NTFS volume. I can't use FileInfo.Length, because that is file size and not size on disk. For example, if I have a 100MB file, but it is only using 25MB due to NTFS compression, I need my script to return...

Regular Expression to split on spaces unless in quotes

I would like to use the .Net Regex.Split method to split this input string into an array. It must split on whitespace unless it is enclosed in a quote. Input: Here is "my string"    it has "six  matches" Expected output: Here is my string it has six  matches What pattern do I need? Also do I need to specify any RegexOptions? ...

How to convert from Virtual Key codes to System.Windows.Forms.Keys

If I intercept a key press using win32 calls, I now have a key code. Is there a way to convert that to a System.Windows.Forms.Keys value? ...

Access text selection within a TreeNode (WinForms)

Is it possible to access information about the text selection within an editable TreeNode of a WinForms TreeView? I discovered methods such as BeginEdit() and EndEdit(bool cancel), but I need finer granularity of control -- something like TextBoxBase.SelectionStart and SelectionLength properties, but on the node itself. Is this possibl...