.net

ToolStrip sometimes not responding to a mouse click

I have a .NET 2.0 WinForms application with a ToolStrip on my main form. Sometimes, the ToolStrip icons don't resppond to the first mouse click, so I have to click the icon twice. It's just a standard ToolStrip with several icons and tooltip texts, I don't do anything special. Is this common? ...

Why doesn't Visual Studio refresh the folders when I click the Solution Explorer refresh button?

In Visual Studio 2008, I can see all my project files in my Solution Explorer, and these files exist in an actual diectory. However, if I add a file to that directory (let's say, an test.sqlite file in the App_Data folder, or say, images created by some other program), then these files do NOT appear in my Solution explorer, even if I cl...

race conditions in WCF with non-oneway methods

I'm designing a client-server chat application (in fact I'm not, but let's pretend I am:)), and I'm a bit puzzled by some race conditions I've experienced. Let's say I've got the following code: public interface IServer { [OperationContract(IsOneWay = false)] [FaultContract(typeof(ChatException))] void BroadcastMessage(string msg...

Convert an array of 'enum' to an array of 'int'.

I'm trying to convert an Enum array to an int array: public enum TestEnum { Item1, Item2 } int[] result = Array.ConvertAll<TestEnum, int>(enumArray, new Converter<TestEnum, int>(Convert.ToInt32)); For some reason Convert.ToInt32 doesn't work when used in Array.ConvertAll, so I had to make some changes: int[] result = Array.ConvertAl...

Do I need full text search and if so how to implement full text search on sql2000?

I'm using Linq2Sql for my asp.net mvc project and so far it has worked out just great. Now however I need to implement a "key word search" that searches for x key words over about 20 fields spread over 10 joined tables that are joined with a maximum depth of 3 levels. The linq function is really simpel, but the generated query is just to...

How can I receive the "scroll box" type scroll events from a DataGridView?

I have a DataGridView, and I'm listening to its Scroll event. This gives me a ScrollEventArgs object whose Type member is supposed to tell me the type of scroll event that has occurred. On the MSDN documentation page it says I should be able to detect movement of the scroll box by listening for events with types ThumbPosition, ThumbTra...

Best server OS to host my .NET applications

Which Microsoft OS versions and tuning tools do you recommend to host applications targeted for the following environments? .NET 2.0- .NET 3.0+ Note: Dont worry about my hardware. Just tell me what would suit me best considering the environments mentioned above and the need for stability, security and high uptime. ...

What would you choose if you could use any .NET DAL technology?

I'm getting back into .NET development after a couple years and it seems that now, especially with LINQ, the way you access your data has changed and become much easier. For instance, in a ASP.NET MVC website, I can: Add Item add LINQ-to-SQL classes drag on database tables onto the LINQ-to-SQL Object Relational Designer, click save ac...

Unable to kill a worker thread in Silverlight

Hello, I'm working on a multi-threaded Silverlight application. The application has two threads: Main/UI and a background working thread. The UI thread should be able to kill the background thread, like so: private Thread executionThread; .... executionThread = new Thread(ExecuteStart); executionThread.Start(); .... executionThre...

Using LinqToSql with NLog

Hi I'm writing an .NET 3.5 web application that is using LinqToSql for the basic database stuff. I'd like to use the nLog library for logging. This library can log to a database using good ol' fashioned stored procedures (not that there is anything wrong with that..) but I'd like to use the LingToSql DataContext to log to the database ...

Implementation options of summing, averaging, concatenating, etc items in an IEnumerable

I'm looking for the shortest code to create methods to perform common operations on items in an IEnumerable. For example: public interface IPupil { string Name { get; set; } int Age { get; set; } } Summing a property - e.g. IPupil.Age in IEnumerable<IPupil> Averaging a property - e.g. IPupil.Age in IEnumerable<IPupil> Buildi...

LINQ to SQL: What gives pain?

I decided to use LINQ to SQL in my personal project after hearing lots of goods. Is there any thing I need to taken care before start using it (during initial design)? ...

XAML: How to mix text and element-databind variables in Content attribute?

When data binding two elements together, how can I include the binding information AND text as in the case below where I want my label to say: The font size is 8.5 <Grid> <StackPanel> <Slider Name="theSlider" Margin="5" Minimum="8" Maximum="14"></Slider> <Label Content="The font size is: {Binding ElementName=theSlid...

ScrollBar in DataGridView

I have a winform in vs2008 that contains a DataGridView. The datagrid contains a list with several columns. These are fixed width, exept one that I have set up to take whatever space is left and fill the width of the view. The winform is resizeable in all directions. The issue I am trying to solve is that when I increase the vertical si...

How can I modify SpreadSheetGear's PrintPreview window (.NET)?

Spreadsheetgear provides ability to create PrintPreview window - using WorkbookView.PrintPreview(). But it seems impossible to modify that window. That function returns void and there are no properties to control the visual content of that window. Please, say me I'm wrong.... Have I missed something? ...

Looking for WPF/XAML example that gets XML from URL and displays in element

I can imagine WPF has a very easy way to grab XML from RESTful services and bind it into elements, e.g. GridView, perhaps even with 100% XAML. Does anyone have any example code showing this? ...

Whats a good use case for an EIMI?

EIMI being an explicit interface member implementation. So instead of: public int SomeValue{get;} you have int SomeInterface.SomeValue {get;} I'm currently considering using one as i'm using an internal interface (to decouple, yet restrict) and I don't want to make the methods on the implementing object to appear in its public API....

Does IL Merge work with .NET Compact Framework

Does anyone have experience using IL Merge and the .NET CF? Does IL Merge work with CF? Are there any known problems? ...

Best way to implement save field in DataGrid when user tabs out or field looses focus

I have a page with .Net grid view with about 12 text fields per row and about 250 rows. Right now there is a save all button at the bottom of the page that sends all the fields 12x250 to the server where they are entered into db 1 by one. Which ends up being very slow and some times does not go through at all. I didnt come up with this ...

.NET String to byte Array C#

How do I convert a string to a byte array in .NET (C#)? Update: Also please explain why encoding should be taken into consideration. Can't I simply get what bytes the string has been stored in? Why this dependency on encoding?!!! ...