.net

C# WebBrowser.Navigate Issue

Hello, I have an XML file stored in the DEBUG folder inside the BIN Folder of my Application (BIN\DEBUG\File.xml) When i call WebBrowser1.Navigate("File.xml"); It doesn't update the view with the display of the file. I know it's something to do with it not locating the file due to the folder location being incorrect. The file has to b...

Parsing a textfile in C# with skipping some contents

Hi, I'm trying to parse a text file that has a heading and the body. In the heading of this file, there are line number references to sections of the body. For example: SECTION_A 256 SECTION_B 344 SECTION_C 556 This means, that SECTION_A starts in line 256. What would be the best way to parse this heading into a dictionary and then...

KeyedCollection with enum key type will not index by int

I have classes public class FooKeyedCollection : KeyedCollection<FooType,Foo> { } public enum FooType { FooType1, FooType2, FooType3 } public Foo { public FooType Type { get; set; } public string Value { get; set; } } When I add items to my FooKeyedCollection, I can index them by FooType, but when I attempt to index t...

Do I have to derive from ConfigurationSection to support per-user settings?

I'm playing around with .NET's configuration support (the ConfigurationManager class and related support classes). I would like to write an application that, once installed: Has default settings in foo.exe.config (in Program Files). The user may later override the settings with nondefault values which should be persisted. The user's p...

What is the current state of XSLT 2.0 availability within .NET

The latest I can find from the web and blogosphere indicate that Microsoft's XML team would be supporting XSLT 2.0 (now that it was a full blown W3C recommendation). I can't find anything beyond that. What's the current status? Is it available in .NET 3.5 or are they stuck with XSLT 1.1 and pushing XQUERY and LINQ? ...

C# TabControl TabPage Change

Hello, How do I change the tabpage being displayed in my tabcontrol programmatically? ...

How do I compare two datasets for equality

I have two datasets each with one data table pulled from different sources and I need to know if there are any differences in the data contained in the data tables. I'm trying to avoid looping and comparing each individual record or column, although there may be no other way. All I need to know is if there is a difference in the data, ...

How do you reset a C# .NET TextReader cursor back to the start point?

I have a method that takes either a StringReader instance (reading from the clipboard) or a StreamReader instance (reading from a file) and, at present, casts either one as a TextReader instance. I need it to 'pre-read' some of the source input, then reset the cursor back to the start. I do not necessarily have the original filename. Ho...

TableLayoutPanel Controls - Lock Column from Horizontal Scroll?

I'm using a TableLayoutPanel in a Windows Forms application to organize a set of controls in a grid-like fashion. I'd like to lock the TableLayoutPanel's first controls column so that it remains fixed when the user applies the horizontal scrollbar. Any guidance is appreciated. ...

Only updating filled in properties

Is there a way to have NHibernate only update the fields that don't have the default value filled in? Say we have this simple class: public class Person { public int Id { get; set; } public string Name { get; set; } public int Age { get; set; } } We also have a standard NHibernate mapping using properties for each field an...

Expose a collection of enums (flags) in Visual Studio designer

I've got an enum of types of data that might be shown in a .NET Forms control and I want to provide an interface for consumers of the control to filter some of the types (set some of the flags). A bit field seems the logical way to do this, unfortunately, the enum starts at 0 rather than 1 (0, 1, 2, 4, 8, ...) and can't be changed. How...

creating long-lived server for other applications on windows

I've looked into COM servers and Windows services but I'm not sure what best suits my purposes or how to do it. What I want is something that can be started and run for an indefinite amount of time which holds an object so that other processes or applications obtain references to that object (or make requests to the server) to modify or ...

Is my Unit Test Sufficient?

I am looking at the Unit Tests I wrote for an email service (unsing SMTP) and I am wondering if one test inparticular is suffient. Here is a snippet of my email service: [PluginFamily("EmailService")] public interface IEmailService { Boolean SendEmail( string toAddress, string fromAddress, string bccAddress, string ccAddress, stri...

SortedDictionary (C#)- change value...

In a SortedDictionary is it possible to change the value of an item ? ...

Performance of Oracle .Net drivers

I'm currently comparing the performance of 4 different Oracle .net drivers. ODP.Net, DataDirect, OraDirect and the Microsoft .Net driver. It seems that the Microsoft driver is the slowest, the others being comparable with DataDirect faster than OraDirect which in turn is faster than ODP.Net. The question I have is whether or not this i...

System.Web.Script.Serialization.JavaScriptSerializer or System.Runtime.Serialization.Json.DataContractJsonSerializer?

What's the difference between the two? Why would you use one over the other? ...

Tag system with search for .NET (and ASP.NET)

Is there a good tag search system that i can use in my C# .NET prototype that will also run on ASP.NET ? ...

ASP.NET MVC Error Logging in Both Global.asax and Error.aspx

I'm creating an ASP.NET MVC application. I need to handle exceptions in two places. Global.asax.vb file: Public Class MvcApplication Inherits System.Web.HttpApplication ... Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) LogException(HttpContext.Current.Server.GetLastError(), Request) End Su...

Multiple user controls on a aspx page

I have a page that dynamically loads multiple user controls on a page. I have a few buttons on each user control that cause a server side event that does some processing related to the user control that triggerred the action. The problem I run into is that this button click causes the entire page to reload (as all the dynamically loaded...

remove from a List<T> within a foreach

I have code that I want to look like this: List<Type> Os; ... foreach (Type o in Os) if (o.cond) return; // quiting early is important for my case! else Os.Remove(o); ... // other code This doesn't work because you can't remove from a list inside a foreach over that list: Is there a common way to solve th...