.net

What is the practical use of "dynamic" variable in C# 4.0?

What is their use if when you call the method, it might not exist? Does that mean that you would be able to dynamically create a method on a dynamic object? What are the practical use of this? ...

What's the best way to get the directory from which an assembly is executing

For my apps, I store some configuration file in xml along with the assembly(exe), and something other temporary files for proccessing purpose. I found some quirk with ".\\" and Application.StartupPath. I've been using String configPath = ".\\config.xml"; It works fine until I called OpenFIleDialog to open some files in other fold...

How do I create a subclass of TabPage that I can edit like a UserControl?

I want to create a subclass of TabPage that contains some control, and I want to control the layout and properties of those controls through the designer. However, if I open my subclass in the designer, I can't position them like I could on a UserControl. I don't want to have to create a TabPage with an UserControl instance on it, I wa...

How do I use HttpWebRequest with GET method

I have the following code which works just fine when the method is "POST", but changing to "GET" doesn't work: HttpWebRequest request = null; request = HttpWebRequest.Create(uri) as HttpWebRequest; request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; request.Method = "POST"; // Doesn't work with "GET" request.Begin...

What is the best way to sort nodes in an XmlDocument? (.Net)

I was using an XSL style sheet to do the sorting but it seems to be very slow. Is there a more efficient way? It is a flat list of nodes, if I convert the nodes to an object and sort in a GenericList would it help? EDIT I don't need the end result to be XML. ...

Best way to store previous search criteria in ASP.NET

I have a web application that allows a user to search on some criteria, select an object, edit it and then return to the previous search. All the editing takes place on a separate page linked to the datagrid of returned results. I was wondering what is the best way to store the previous search parameters so that when they return to the...

Managing Data Prefetching and Dependencies with .NET Typed Datasets

I'm using .NET typed datasets on a project, and I often get into situations where I prefetch data from several tables into a dataset and then pass that dataset to several methods for processing. It seems cleaner to let each method decide exactly which data it needs and then load the data itself. However, several of the methods work with ...

simple DataGridView refresh question

whats the best way to refresh a DataGridView when you update the base data source? i'm updating the datasource frequently and wanted to display the outcome to the user as it happens. i've got something like this made (and it works), but null'ing out the DataGridView.DataSource doesnt seem like the right way. List<ItemState> itemStates...

Compare memory footprint of .Net and VB6 applications.

I've been trying to compare the memory footprint between a VB6 application and .Net application. Trying to determine what's the average difference between the two. The .Net code is for the most part a direct translation of the VB6 and for the most part has the same instructions as they would be programmed in C#. So while it's an apple t...

Alternative site to Mike Gunderloy's "The Daily Grind" (Larkware)?

As a developer who is always looking for new resources and information, I loved Mike Gunderloy's blog "The Daily Grind" on www.larkware.com ("We get up early, so you don't have to.") Unfortunately (for me) Mike decided to discontinue the blog in December 2007. So, my question: is there a similar blog / site which provides such good link...

Do IDbCommand, IDataReader, or DataTable leak resources if Dispose is not called?

When using IDbCommand, IDataReader, or DataTable, can you depend on the destructor to dispose resources, or will these objects leak resources if dispose is not called directly? ...

.Net Converting a number from one culture to another

Quick question -- In .Net (VB more specifically, but that doesn't really matter), is there a way to change the format of a number from one culture to another strictly through the that number's type? The issue is this: In English, the number is say, 123.45. Whereas in Sweden, the number would be 123,45 Is there a way to convert 123,4...

How to create an SQL Compact 2008 application

How can I make a SQL Compact 2008 application for the desktop? I know how to connect to a .SDF file with SQL Management Studio 2008, but I can't figure out how to connect to it with my app. I have seen tutorials about this and I can see in the C# code they are referencing some special namespaces, but I can't seem to get it to work. Wh...

C# dictionaries ValueOrNull / ValueorDefault

Currently I'm using var x = dict.ContainsKey(key) ? dict[key] : defaultValue I'd like some way to have dictionary[key] return null for nonexistant keys, so I could write something like var x = dict[key] ?? defaultValue; this also winds up being part of linq queries etc. so I'd prefer one-line solutions. ...

Best .NET graphics library for 3D sphere drawing?

I am going to be making an application that lets users input several parameters for a bowling ball layout, and then show what that layout would look like on the ball. I have found some good resources for sphere math, so if I have a sphere whose center is (0,0,0), I will be able to get the values of the points I need on the surface of th...

When can I dispose an IDisposable WPF control e.g. WindowsFormsHost?

The WPF control WindowsFormsHost inherits from IDisposable. If I have a complex WPF visual tree containing some of the above controls what event or method can I use to call IDispose during shutdown? ...

How to work with objects using Dynamic WCF?

We currently have developed an application using WCF. Our clients make connections to different WCF servicehosts located on the server, and the servicehosts return the data from the DB that the clients need. Standard model. However, this current design has all of our WCF data in app.config files both on the client side as well as the ser...

.NET : How do you get the Type of a null object?

I have a method with an out parameter that tries to do a type conversion. Basically: public void GetParameterValue(out object destination) { object paramVal = "I want to return this. could be any type, not just string."; destination = null; // default out param to null destination = Convert.ChangeType(pa...

msvcr71.dll file missing on Win Vista when trying to run my java swing application

I've done numerous searches and I realize that I can just download this file and install it either in windows/system32 or in the application's directory. My question is, how does this dll generally get installed on Vista? I tried installing the .net framework 3.5 and it didn't get installed with that. Background: I'm running a java.jar...

What is the correct format to use for Date/Time in an XML file (.NET)

What format do I use for Date/Time when writing to an XML file using .NET? Do I simply use DateTime.ToString(), or do I have to use a specific format? ...