.net

Improve coding with List Intersect using Net 3.5

I've a class that has a list of IDs with a function for adding new IDs from a list of objects. I've got this resolved, but I'm sure this can be done with much less code. Public Class Page Private _IdList As List(Of Integer) Private _HasNewItems As Boolean = False Public Sub AddItems(ByVal Items As List(Of Item)) Dim itemsI...

How do you make an application start when the device starts up in Windows Mobile?

As the title says. I'd like for my application to start when the Windows Mobile device is turned on? I'm developing this app using the .NET Compact Framework 3.5 in C#. Thanks! ...

Framework + Client Code references

Hi, We are simultaniously working on a base-framework and on a implementation (little test tool) on top of it. There are several things I'd like, and I am wondering if they are all possible: (.NET 3.5, VS2008) Have a .sln with only the implementation (tool) - project Have a .sln with tool + framework projects Have a .sln with only f...

Resolving classes without registering them using Castle Windsor

Take the following useless program: class Program { static void Main(string[] args) { IUnityContainer unityContainer = new UnityContainer(); IWindsorContainer windsorContainer = new WindsorContainer(); Program unityProgram = unityContainer.Resolve<Program>(); Program castleProgram = windsorContai...

Generic method for reading config sections

Am trying to implement a generic way for reading sections from a config file. The config file may contain 'standard' sections or 'custom' sections as below. <configuration> <configSections> <section name="NoteSettings" type="System.Configuration.NameValueSectionHandler"/> </configSections> <appSettings> <add key="AutoStart" value="t...

Why is Math.DivRem so inefficient

In my computer this code takes 17 seconds (1000 millons times) static void Main(string[] args) { var sw = new Stopwatch(); sw.Start(); int r; for (int i = 1; i <= 100000000; i++) { for (int j = 1; j <= 10; j++) { MyDivRem (i,j, out r); } } Console.WriteLine(sw.ElapsedMilliseconds); } static int MyDiv...

In C#, is there a way to open a 2nd form with a tab selected?

Does anyone know a way to open a 2nd form in a .NET application with a certain tab selected in a tab control on that form? This is what my current code looks like which just opens the form: SettingsForm TheSettingsForm = new SettingsForm(this); TheSettingsForm.Show(); SettingsForm.cs is the name of the 2nd form to be opened. Thanks ...

Why do nullable bools not allow if(nullable) but do allow if(nullable == true)?

This code compiles: static void Main(string[] args) { bool? fred = true; if (fred == true) { Console.WriteLine("fred is true"); } else if (fred == false) { Console.WriteLine("fred is false"); } else { Console.WriteLine("f...

Get inbox message from Exchange server using .net

Anybody knows how to do this? I need to create a service that will connect to the exchange server and download the messages ever x minutes... thanks! ...

Introducing an IoC Container to Legacy Code

I'm writing a new .NET library for internal use at my company that will use IoC through Dependency Injection. Naturally, this library will be much easier to use if we use an IoC Container to resolve instances. However, the code that will be making calls into this library does NOT currently use Dependency Injection of any sort, and refa...

Computer A can reach network web service, while computer B can't. Any ideas?

You'll have to pardon me as I wasn't sure where to place this. This overlaps in the areas of C# Web Services and Network/Security management I suppose. I have a server that runs various web applications. One of them is a web service. The account everything runs under is a local account on the machine. It is not a domain account. I don't...

How do I unsubscribe all handlers from an event for a particular class in C#?

Basic premise: I have a Room which publishes an event when an Avatar "enters" to all Avatars within the Room. When an Avatar leaves the Room I want it to remove all subscriptions for that room. How can I best unsubscribe the Avatar from all events in the room before I add the Avatar to a new Room and subscribe to the new Room's events...

System.Runtime.InteropServices.COMException (0x82DA0002): Exception from HRESULT: 0x82DA0002

Does anyone know what this means? System.Runtime.InteropServices.COMException (0x82DA0002): Exception from HRESULT: 0x82DA0002 at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous) at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args) at Midden.cMid...

System.Data.OracleClient requires Oracle client software version 8.1.7

I have a web site that I developed on Vista using Vb.net9. It makes a connection to Oracle. for the connection I use System.Data.OracleClient. It works fine on my machine, and our test server, but it does not work on the production server. We installed the Oracle Client 11 on the server. The error is System.Data.OracleClient require...

Multi-line Row grid controls

Does anyone know if there are any multi-line row grid controls for sale or open source for use in .net? ...

How do I prevent print screen

I have a requirement that an application I am working on prevent the user from being able to easily capture the contents of the screen. I have communicated that there is no feasible way to completely prevent this from happening, but I'm looking for methods to introduce some hurdles to the process. I'm using C#/.NET 2.0 and WinForms ...

.NET - Server-side Markdown to HTML Conversion

What is a good open source .NET library to convert markdown to HTML on the server? If this has been answered somewhere else please point me to the post. Thanks. ...

What's the best way of forcing a DataGridView Cell to accept numeric input only?

Currently I'm using: Private Sub dgvStock_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvStock.CellEndEdit Select Case Me.dgvStock.Columns(e.ColumnIndex).Name Case "Quantity", "Unit Cost" If Not IsNumeric(Me.dgvStock(e.ColumnIndex, e.RowIndex).Valu...

.NET UserControl for CSS columns?

Are there any .NET Controls out there to help with CSS layout and make it nice and easy to quickly make changes - possibly dynamically. Update: I've pretty much give up on this idea as I've researched more about CSS best practices. I've decided to use Yahoo YUI's reset css and grids css to get layouts that can be more easily changed a...

Is there a .NET IoC that prefers convention over configuration?

Simply put, if you had to use a IoC/DI container, thats easy to deploy (not a big fan of using config/xml file for everything), stable, good documentation and supports .net, which one would it be? It could just be me but too many xml files like one for the app, a few for ORM, a few for another component kinda gets overwhelming at times....