.net

My application is unmanaged. Where do I start introducing managed code?

My whole application (which is rather big, with a 20MB executable) is written in unmanaged C++. Because I can clearly see the advantages in using managed code, I want to start introducing managed code in my application, but where do I start? Can I easily start to use C++/CLI and link it with the rest of my application? (although the C++...

Force UI update on the fly, after changing current culture in WPF

I need to support UI language change through the application menu. The texts are localized using resource files (similar to approach 1 here) if I set the Thread.CurrentThread.CurrentUICulture before the ctor calls to InitializeComponent(), the UI is changed as it should. However, if the CurrentUICulture is changed during the normal run...

Removing items from a List(Of t) in vb.net failing

I have a generic list that I'm removing items out of using List.Remove(Object). I have been removing items but whenever I get to the fifth item I'm removing it fails and does not remove it from the list. It doesn't seem to matter what I'm removing but everytime I try to remove five items it fails on the fifth item. What could be causin...

Hide all windows for a process (ex. Internet Explorer)

I am using WatiN to script actions in Internet Explorer that run in the background of the user's machine. (I know...hacky). I am able through WatiN to make the Internet Explorer window not show. However, during my script, some HTML dialogs are opened. I am able to hide them using the P-Invoke ShowWindow in User32.dll, but they still ...

WPF .Resx editor for localization

I am looking for a simple tool that allows the translators to edit .resx files, in order to translate the applications' texts. Visual Studio's Windows Resource Localization Editor is unable to edit these files, unlike Winforms applications. Any suggestions? Edit: I've found a nice free tool at CodeProject that does excatly what I ne...

NETCF DataGrid scroll row into view?

Quick question regarding the Compact Framework DataGrid. How can I scroll a particular row into view? We have an application that displays scans in a datagrid. If the user scans a new item I add it to the grid, but if they scan an existing item, I'd like to scroll that item into view. Is there any way to do this? I tried using the foll...

Programatically invoke garbage collector

Is there a way to invoke the garbage collector on a specific object within managed memory from an application? e.g. (in pseudo-code) Read myString from file; perform arbitrary operation on myString; invoke garbage-collector to remove myString ...

MEF exception " 'SourceProvider' must be set."

I am playing around with the new System.ComponentModel.Composition namespace in .NET 4.0 beta 2, also known as the Managed Extensibility Framework. I use the following C# example where a Monkey imports a Banana: public interface IBanana { } [Export(typeof(IBanana))] public class Banana : IBanana { } public class Monkey { [Im...

Object Construction at Client or Business Layer?

Something I've noticed from looking at multiple .NET starter kits is that business object construction is often handled at the client level. Then, the business object is passed to the business layer for manipulation, serialization to the database, etc. Shouldn't this code be abstracted to the business layer, so that the client only needs...

Insert into NameValueCollection in .NET

Is it possible to insert an item into a NameValueCollection in a specific index? I don't see an Insert() method. ...

Visual Basic and a Namespace Issue

I was cleaning up a Visual Basic (.NET 2.0) solution. Splitting it into two projects. 150 classes have the Namespace RebateCalculator at the top of the file. These files are now sitting in Project with the default namespace RebateCalculator. If I were to insert a Class1.cs file and then namespace declaration that all my other files have ...

Why is my .Net app contacting Verisign?

I wrote a .Net application that has nothing to do with network communication. There is not a single line of code in the whole application that uses the NIC, but my firewall has caught it trying to contact Verisign for some reason when the app starts. This does not happen regularly; as a matter of fact, it has only happened twice. The la...

.NET compact framework signature drawing GUI element

Is there a way to allow a user to draw with their stylus (a signature in my case) in a Windows Form? Something like InkCanvas in WPF. I don't think I can use WPF in a compact framework project, or maybe I'm setting it up wrong. thanks ...

Simple background thread restarting in .NET

I'm working on an WPF application that has a few threads that are processing information in the background. If one of the threads crashes, it brings down the app. I'm going to correct that by wrapping the function passed to threadstart in a try/catch. However, I was wondering if I could do one better. It should be possible to write a si...

TypeConverter when binding to ASP.NET GridView

I am trying to bind an IList of objects to a GridView's DataSource and one of the properties of the object is an enum. I was trying to use a TypeConverter on the enum to use a Description when the object is bound to the GridView Row. It does not look like my EnumConverter.ConvertTo method is being called. Will a TypeConverter be calle...

How to enable user settings to libraries used by a web project hosted WCF service?

By default a IIS hosted WCF service can't use libraries that uses user scope settings. The only scope that it accepts is the Application scope. When you try to do otherwise it throws an exception: [System.Configuration.ConfigurationErrorsException]{"The current configuration system does not support user-scoped settings."} How to c...

Unity IOC Static Factories

Is there a way via xml configuration to denote a static factory method on an object? ...

How to show address bar in webbrowser control in a C# winform?

How to show address bar in webbrowser control in a C# winform? Thanks, Karthick ...

asp.net mvc JQuery .load SessionState missing keys

Hi I am having an issue where i am trying to use JQuery to populate a div tag using the load function on a asp.net MVC website. I am calling a partialview through a controller and it works fine when i call it directly in the browser but when i try to call it through jquery i get an exception. My partial view uses the sessionstate to ob...

Confirm Email on Dotnetnuke Registration

I have a registration page in Dotnetnuke. I want to have a confirm email field, because a lot of our users are mis-entering their email. I've looked at this seven ways to Sunday, and can't figure out how to get this to happen. I've dug through the circuitous logic for displaying the form (I think), and I can't find the right place to h...