.net

Method to determine if path string is local or remote machine

What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server? It's possible to determine if a path string is UNC using the following: new Uri(path).IsUnc That works great for paths that start with C:\ or other drive letter, but what about paths like: \\machinenam...

Agile Development and ESBs

I'm working on shifting our corporate technological paradigm to Agile Development. It's been a hard process but we're almost there! :) We have legacy systems for our database management (used to be Access, now ported to .NET and MS SQL) and we're developing a framework for our future vision. We want to migrate as much as possible to the...

Example sql for logging exceptions to database using exception handling application block

Can anyone provide (or point me to) example sql code for logging exceptions using Enterprise Library Exception Handling Application Block (EHAB)? ie I'd like standard CREATE TABLE and CREATE PROCEDURE statements for the structures and procs to store logged exceptions in a SQL Server database. Also, can anyone describe how the app block ...

Using a DetailsView in ASP.Net when using an ObjectDataSource or a SqlDataSource

How do you use a DetailsView control in Asp.NET? How do you change the labels to something other than the database field name? How do you hide some of the fields from the user? (which you need to query for because they are the identity fields - row-id, which you dont want the user to see)? ...

DetailsView and Parent-Child tables - inserting rows

When you have parent-child tables and you wish to use a DetailsView to edit the data how do you do it using a SqlDataSource? For example, if you have a Person and an Employee table (where an employee is the child table and the Person is parent table - an employee derives from a person). Person P_ID FirstName LastName DOB Employee E...

How do I use DMProcessConfigXML to provision my Windows Mobile device?

I want to create a C# program to provision Windows Mobile devices. I have found MSDN documentation on a function called DMProcessConfigXML, but no instructions on how to use this function. How can I use this function in my Windows Mobile app? I suspect it has something to do with using pinvoke. Thanks, Paul ...

Can you bind the selected item in a listbox to a separate object in WPF?

If I have two objects, one being the list of items, and the other having a property storing the selected item of the other list, is it possible to update the selected item through binding in WPF? Lets say I have these two data structures: public class MyDataList { public ObservableCollection<Guid> Data { get; set; } } public class...

Formatting double as string in C#

I have a Double which could have a value from around 0.000001 to 1,000,000,000.000 I wish to format this number as a string but conditionally depending on its size. So if it's very small I want to format it with something like: String.Format("{0:.000000000}", number); if it's not that small, say 0.001 then I want to use something lik...

Is there a string math evaluator in .NET?

If I have a string with a valid math expression such as: String s = "1 + 2 * 7"; Is there a built in library/function in .NET that will parse and evaluate that expression for me and return the result? In this case 15. ...

What's quicker at resolving, DataSet.Tables or Dictionary<string, Tables>

I am creating a mock database for import export tests (of the algorithm reading and writing complex data structures to our database, not just to test IO operations), and am trying to decide whether to use a DataSet to store the mock tables (by table name) in the faux-database, or Dictionary() In terms of retrieving a datatable by name, ...

Is there a way to change several textbox's readonly attribute programatically.

Is there a way to change several textbox's readonly attribute programatically in .net. ...

Convert VB.NET --> C# Projects

Hi Can anyone recommend a good application that could be used to convert VB.NET projects to C#, without having to do too much manual work? We've used Reflector to do small libraries manually, but some of the larger projects will be too slow and complex to do this manually. ...

Does TcpListener.AcceptTcpClient throw uncritical exceptions?

In my application, I currently stop listening when AcceptTcpClient (or EndAcceptTcpClient) throws an exception. Typically exceptions are thrown when I stop the listener (socket error 10004) or when I disconnect the network adapter. try { while (true) { TcpClient client = listener.AcceptTcpClient(); // omitted: st...

WCF: How to get Binding object from configuration

I would like to get Binding object from web.config or app.config. So, this code works: wcfTestClient = new TestServiceClient("my_endpoint", Url + "/TestService.svc"); but I would like to do the following: Binding binding = DoSomething(); wcfTestClient = new TestServiceClient(binding, Url + "/TestService.svc"); I am interested in D...

Locking out a user in an ASP .Net Custom Membership Provider

I've had to create a custom membership provider for my current ASP .Net project in order to fit in with our database schema, and am having problems configuring it to lockout a user if they get their password wrong three times, as is supported by the standard providers. Is this something I need to implement myself, or should it be suppor...

.NET: Replacing ImageMagick with WPF-objects

We've all seen cool WPF demo-applications with rich media. My question is if WPF-objects can replace some basic functionality in ImageMagick. Basic functions like resizing images, cropping and so on. The results from .NET 2.0's System.Graphics-namespace's resizing is just sad (GDI+). Maybe I'm using it wrong, but out of the box it seem...

The best way to store class instances to a file/database

What is the best way to store instances of a class to file/database? We have a base class called Command and loads of derived classes. Users create instances of these classes by adding commands to a graphical designer where they can configure them. (Set the properties). We then need a way to store these "commands" to a file without los...

What is the best way to access properties from the same class, via accessors or directly?

This is something I'm not much consistent about and always curious about what other people do. How do you access internal properties (private or public)? For example you've got this property : Private _Name As String Public Property Name() As String Get Return _Name End Get Set(ByVal value As String) _Nam...

Resolving compiler error CS1519: Invalid token ',' in class, struct, or interface member declaration

I'm working on an ASP .NET 2.0 site which uses a Web Application project file, and therefore compiles to a dll rather than deploying the source code as you do with the older style Web Site projects. The site works fine on my test server (Windows Server 2003 R2, IIS6) when it runs in the root of a website. However I need to run it under ...

Assembly binding problems in .NET

I am writing a .NET library that for various reasons cannot be registered in the GAC. This dll (let's call it SDK.dll) depends on other DLLs in order to be loaded. When writing a program that uses this SDK.dll, I noticed that my program failed loading the dll with a FileNotFoundException thrown. This happens because although I was able ...