.net

dotnet: How do you get average character width for a font?

Windows Forms: For System.Drawing there is a way to get the font height. Font font = new Font("Arial", 10 , FontStyle.Regular); float fontHeight = font.GetHeight(); But how do you get the other text metrics like average character width? ...

Verify an XPath in .NET

How can I verify a given xpath string is valid in C#/.NET? I'm not sure just running the XPath and catching exceptions is a valid solution (putting aside the bile in my throat for a moment) - what if tomorrow I run into some other input I haven't tested against? ...

How to split Oracle sql statements for ADO.NET

What is the proper way to split up SQL statements to send to an Oracle ADO.NET client? For instance, lets say you have the following code in a text file and want to execute these statements: CREATE TABLE foo (bar VARCHAR2(100)); INSERT INTO foo (bar) VALUES('one'); INSERT INTO foo (bar) VALUES('two'); I believe trying to send all tho...

How do I get Gridview to render THEAD?

How do I get the GridView control to render the <thead> <tbody> tags? I know .UseAccessibleHeaders makes it put <th> instead of <td>, but I cant get the <thead> to appear. ...

Debug and Release Assembly Refrences in XAML

In a XAML namespace declaration, is there a way to disambiguate differently named assemblies depending on your current configuration? I'm in the process of reworking a projects build system. The old system had the debug and release assemblies building to seperate directories, which meant the following (roughly) would work fine at the t...

Does ActiveRecord handle locks and updates?

ActiveRecord doesn't seem to cater for record locking and database updates. How does one synchronise updates in disconnected multi-user environments such as websites and web services? ...

In Visual C# I cannot make my public class public

I'm trying to make a program in Visual C# that has my one created class, and at application launch it creates an array of my class object, and this array of my object can be used all over the program. So any function, or a control's event can access the array of objects and their member variables. I created my class as "public" but for s...

Is it possible to create a message box that shows html-contents?

I want to diaplay message boxes that looks good, with the possibillity to use bold/italic text and text with different colors. The standard MessageBox.Show doesn't provide this functionality. I have been trying to create a message box using the WebBrowser control to display nicely formatted text using HTML-syntax. But I haven't succeede...

Xml Serialization and Schemas in .net (C#)

The following questions are about XML serialization/deserialization and schema validation for a .net library of types which are to be used for data exchange. First question, if I have a custom xml namespace say "http://mydomain/mynamespace" do I have to add a [XmlRoot(Namespace = "http://mydomain/mynamespace")] to every class in my...

Programmatically generating typed DataSet for LINQ - "Metadata file" missing?

Title says what i'm trying to do. I can successfully generate an assembly if i don't specify the LinqOverTypedDatasets option, but i want my typed DataSet to support queries with LINQ. My code outputs the error: error CS0006: Metadata file 'System.Data.DataSetExtensions.dll' could not be found The code: //System.Data.DataSet myDataS...

Best quality/price shared Web Hosting for Asp.Net Mvc

I am having several problems deploying my Asp.Net MVC application with my current web hosting and I am thinking about trying a new one. What is in your opinion the one with best quality/price that allows to easily deploy ASP.Net MVC applications? Thanks! ...

What automatic code generation tools are available for Castle ActiveRecord classes?

If I have an existing database, I want to be able to automatically code generate the corresponding Castle ActiveRecord C# classes based on the db schema. My primary intent is to avoid manually creating each class. What are my options for code gen tools with templates that can already specifically do this for Castle ActiveRecord? (Note:...

VS 2008 Issue ->>Unable to start program

Ok I have a web application in 2005,. net 2.0 , I converted it to 2008 .net 3.5. when i attempt to run it in VS 2008 either debug or release I get the above mentioned error: Unable to start program http:\localhost\MyWebApp no other message just this. I can access my program directly thru iis and it runs. It runs on another dev m...

Using Amazon AWS to create an offline database

Hi, Problem Statement: I would like to create an offline database to lookup prices/info on the n most useful books to sell in the United States (where n is probably 3 million or so). Question: So, my question is (and I am open to other approaches here as well), I am trying to figure out how to use Amazon AWS to download a list of the ...

Determine if current user is a domain or local user?

Is there a way to determine (.NET preferably) if the current user is a domain user account or local user account? Ahead of time - I don not know the domain name this is running on so I can't just look for DOMAIN\Username v COMPUTER\Username. Part of the answer could be determining the DOMAIN or COMPUTER name from code. [Edit] Expandi...

In C#, How can I serialize Queue<>? (.Net 2.0)

At the XmlSerializer constructor line the below causes an InvalidOperationException which also complains about not having a default accesor implemented for the generic type. Queue<MyData> myDataQueue = new Queue<MyData>(); // Populate the queue here XmlSerializer mySerializer = new XmlSerializer(myDataQueue.GetType()); StreamW...

Should .NET Assembly names include a version number?

We currently have a heated internal debate as to whether the actual .NET assembly name should include the code's version number (e.g. CodeName02.exe or CompanyName.CodeName02.dll). Does anyone know of an authoritative source, like Microsoft, that provides guidance on this issue? ...

Installer for .NET 2.0 application for Windows 98

How can an automatic installer for .NET 2.0 application be created for Windows 98? I mean for application and also for .NET 2.0 if missing. I tried to do it by creating a setup project for Visual Studio 2008, but I didn't succeed. I installed IE6 SP1 manually, but Installer still crashed. Windows Installer 2.0 is installed. It's impos...

How to prevent writing object changes to the database on Flush with Castle ActiveRecord / NHibernate

The default behavior of NHibernate is the write all changes to objects to the database when Session.Flush() is called. It does this whether you want it to or not. How do we prevent writing bad data to the database when we need to do things like validate business rules or input? For instance .. Customer Name is not null. User opens ...

C# - Get list of open tasks

I'm trying to find a way to get the open tasks in C#. I've been searching on google and can only find how to get a list of the processes. I want the only the tasks that would show up on the taskbar. Also, along with that, it would be cool if I could get the process the task is associated with. And if possible get the thumbnail images...