.net

Handling new library features in old applications

We are working on a new library version that contains some UI controls that are used by other applications. Some of these controls have new features that the old applications don't know about. We will disable the new features by default, but there are specific apps for which we'd like to enable them. The apps are likely to exist on th...

What is Uri.LocalPath defined to do with non local paths?

The docs for Uri.LocalPath don't say what happens if you feed it a non local path like http://stackoverflow.com/. Does anyone know of a source that gives the official spec for how it handle this? I'm wanting to know what kind of gotchas and corner cases it might have so I can't be sure I've got thing right by just trying things. (alter...

what things can you do in vb.net and not in c#

Duplicate of: http://stackoverflow.com/questions/840397/static-variables-in-c http://stackoverflow.com/questions/158229/what-are-the-pros-of-vb-net http://stackoverflow.com/questions/623747/moving-from-c-to-vb-net http://stackoverflow.com/questions/14775/interview-question-on-c-and-vb-net-similarities-differences From TStamper in thi...

Is it possible to write multiple iterators for a type in C#?

So for a type like: CoolCollection<T> you could have: foreach (T item in coolCollection) { ... } foreach (CoolNode node in coolCollection) { ... } If this isn't possible, maybe like foreach2, or some other way to iterate. Often times, I would really like more than 1 way of iterating on a type. EDIT: Sorry if it wasn't cle...

WPF: How to import a resource from a child item

I would like to define two similar-looking views on some graphical data. One view is an editor and the other is a viewer that shows the data being transformed. I am not sure what the best way is to share code and resources between the two views, but I have tentatively decided to make a UserControl to represent the part of the visual pres...

.NET 2.0 DateTime.ToString() conversion to different time zone

is there a format in ToString() method of DateTime to convert the time Zone to say UTC ? I know I can programatically first convert the DateTime to UTC and then call ToString, but I have a UI where the user can specify format, can they at the same time convert to UTC ? ...

Lost FK relationship with LINQ-SQL designer

I have three tables in my DB (actually a few more than that) these are: Users ----------- ID (PK) Name Sites ----------- ID (PK) SiteName Users_Sites ----------- ID (PK) UserID (FK to Users.ID) SiteID (FK to Sites.ID) and I have a unique constraint on UserID and SiteID in the Users_Sites table. All very standard stuff. My...

How can I programmatically remove the 2 connection limit in WebClient

Those "fine" RFCs mandate from every RFC-client that they beware of not using more than 2 connections per host... Microsoft implemented this in WebClient. I know that it can be turned off with App.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.net> <connectionManagement> <add address="*" maxconnecti...

Winforms MVP Grid Events Problem

I am trying to implement the MVP pattern for WINFORMS. Its a simple for with a button and a Grid, on button click, the grid will load, and user can fill in values into the grid. For my button click event, I have something like this: _presenter.LoadGrid(); Which is simple and straightforward. My question is, in regards to grid... I am...

How to implement Dispose in a COM object

I have written a COM component in unmanaged C++ to provide customers access to our database. When using it from an unmanaged language the database connections are correctly cleaned up as the objects go out of scope. I recently tried using it from VB.NET and discovered that the COM objects are not being destroyed. Scattering calls to S...

How to retrieve info on a loaded assembly at runtime? (c# , .NET)

In .NET c# 3.5 I have a console application (A) that references several assemblies(X, Y, Z). How can I get the version information of the loaded assemblies at run time? I can use reflection to get the info on the currently executing assembly like this System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() b...

Print Multipage in WPF

Hi, i have to print my form but it is big to enter in only one page so i need to print it in 2 pages ,my poor knowledge allow me to know how print one page but hot how print in multipage . Do you have any advice how i can print in multipage,all kind of help will be appreciate. Thanks. Good Work ...

Do not close ContextMenuStrip on selection of certain items

Is it possible to leave a ContextMenuStrip open after a selection/check of certain items? I plan on using a simple ContextMenuStrip to set a filter (this way i could use the same filter either in a menu or as a right-click option). The menu lists a number of items, and i would like the user to be able to make a selection of the items u...

Can I get the primary key of an inserted row, using ODBC?

What is the best way to retrieve the primary key of an inserted row, when using ODBC objects in .NET? For example (VB): Dim command As OdbcCommand = gOdbcConn.CreateCommand() command.CommandText("INSERT INTO auhinode (node_key, node_desc) VALUES (0, 'New Node')") ... Dim result As Integer = command.ExecuteNonQuery() I've seen a coupl...

Dynamically create tests in NUnit

Using Nunit, I want to be able to write a test fixture that will read all the filenames in a particular directory and create a test for each file. I could quite easily write one test method that scans through the directory and just does all the tests, but when I run NUnit I want to be able to see each of the tests individually. Is this...

Is there a way to count the number of seconds since bootup?

Is there a way to count the number of seconds(ticks?) since bootup even if a user change the time on computer? ...

How to export a struct definition from a native C .dll for use in C#

I know how to extern methods in the .dll, how do I extern structs? I want to create a C method such as extern __declspec(dllexport) myStructure getStruct(); where myStructure is something like typedef struct { int A; int B; char C; } myStructure; How can I call getStruct() from a piece of C# code without first defining th...

What is the compelling scenario for using Monads in C#

Let me state up front that I have an infantile understanding of Monads. I have read the various threads on Monads here and have done a few hours of study on the concept. I hardly feel comfortable with the term, but I think it is safe to say that I generally understand what a Monad is/does. I'm a C# developer who is looking to improve th...

Javascript image change causes embeded UserControls to flicker

I have a n html page being displayed in IE. It has some buttons made up of images with mouseover/mouseout events on them in JavaScript, and a bunch of embedded .Net UserControls. When the mouseover/mouseout events fire, I change the images src to something else (simple rollover effect). The problem is that the UserControls often (but ...

How much ASP.NET should I learn if my final goal is ASP.NET MVC?

Starting from scratch with very little knowledge of .NET, how much ASP.NET should I learn before I start to dive in ASP.NET MVC? ...