.net

ResourceManager trying to load .resources not .resx file

I am trying to load a resx file in my .net website using: ResourceManager rm = new ResourceManager( "Project.Resource", Assembly.GetExecutingAssembly() ); The Resource.resx file is in the folder App_LocalResources and is set to be embedded in assembly on build. When I try to access the resx file using: rm.GetString( "key" ); or rm.G...

Async HttpWebRequest - thread number

Let's say I have the following code : ThreadPool.SetMinThreads(100, 100); for (int i = 0; i < 100; i++) { var request = WebRequest.Create(url); request.BeginGetResponse(ar => { //inside AsynchCallBack method for request.BeginGetResponse() var response = (HttpWebResponse)request.EndGetResponse(ar); string html; using (var ...

Hosting Silverlight without IIS

Is there a way to embed a web server, or other means, in a .NET application so that the GUI could be presented as a Silverlight application? Currently we have an application that is client/server. We are using sockets to communicate and passing messages back and forth. One thought was to rework this as a Silverlight solution. The use...

Adding domain group to local group

I have this simple code: String containerPath = String.Format("WinNT://{0}/{1},group", Environment.MachineName, localGroupName); using (System.DirectoryServices.DirectoryEntry theContainerGroup= new System.DirectoryServices.DirectoryEntry(containerPath )) { String path = String.Format("WinNT://{0}/{1},group", theGroupToAdd_Domain, t...

Copy ACL information like XCopy

We recently were forced to move to a new domain server half-way around the world. This may not seem like much of a change, but one of the processes that we run frequently has suddenly gone form a 2-second command to a 5-minute command. The reason? We are updating the permissions on many directories based on a "template" directory struct...

.NET date handling: parse 15-OCT-08 15.36.16.280000000

The custom date strings in .NET allow you to parse a date with seven fractional parts of a second using fffffff I need to parse data exported from Oracle SQL Developer which looks like: 15-OCT-08 15.36.16.280000000 I count nine fractional parts but fffffffff is not a valid date format. In fact: ? DateTime.Now.ToString("dd-MMM-yy H...

WPF MoveFocus() working on Vista, not XP

The following bit of code works on Vista as expected (focus is moved down the ListView), but on XP SP3 (with .Net 3.5 SP1 on both) it moves only between the first two items of the ListView. if (myListView.SelectedItem != null) { IInputElement orig = FocusManager.GetFocusedElement(this); FocusManager.SetFocusedElement(this, myLis...

How to get a Content control to present a data template for a selected field in a WPF gridview?

so I have the following definition for a DataGrid control: <Custom:DataGrid x:Name="dataGrid" ItemsSource="{Binding Units, Mode=Default}" AutoGenerateColumns="False"> and later in the same XAML document I have the following Content control: <ContentControl Content="{Binding SelectedUnitResults, Mode=TwoWay}"/> What I would like to ...

Determine if Crystal Report has no data before showing

I have a winforms application, when a user runs a report there may be no data to display. I'd like to intercept the fact that there is no data an instead of showing the blank report, display an error message using .NET. Is there a property I can check before the report displays? ...

How can I specify the Oracle Home to use when using System.Data.OracleClient

I'm working on an Excel Addin (VSTO) in .NET that connects to an Oracle 10g database. I'm running on Vista x64 and have figured out that I need both the x86 and x64 Oracle clients installed on my machine so that both 32 bit processes (like PL/SQL Developer) and 64 bit processes (like an example .NET console app compiled for "Any CPU") c...

How do I use !gcroot

From within visual studio immediate window with SOS debugging extension loaded I can do !dumpheap -stat Then I get something like this: total 108,014 objects Statistics: MT Count TotalSize Class Name ... 0x00be209c 135 714108 System.Object[] 0x79b925c8 218 2659728 System.String 0x00be2c3c ...

Should IDisposable be applied cascadingly?

This is a rather basic question, however I'm still struggling with it a little. IDisposable is implemented, when you want to enable the user of an object to free underlying resources (e.g. sockets etc.) before the object is eventually garbage collected. When i have a class that holds a DbConnection (implements IDisposable), does my cla...

How do you do MessageCount on MSMQ Queue in dot Net?

Using COM you can get the MessageCount property of a queue. I can achieve the same thing with the MSMQ.Interop, but I was wondering if there is any way to do this with a pure dotNet approach? ...

How can I include DBNull as a value in my strongly typed dataset?

I've created a strongly typed dataset (MyDataSet) in my .NET app. For the sake of simplicity, we'll say it has one DataTable (MyDataTable), with one column (MyCol). MyCol has its DataType property set to "System.Int32", and its AllowDBNull property set to "true". I'd like to manually create a new row, and add it to this dataset. I cre...

C# Com Retrieving binary Image (Tiff) Data from device

I am trying to retrieve Tiff image data through COM using a StringBuilder but the buffer only has a length of 3 after the COM call. I am converting a VB.NET version to C# which uses a String instead of StringBuilder and is working just fine. If anyone has any suggestions or can point me to some good reading material I would appreciate ...

Sorting Two Combo Boxes Differently in WPF

Hi, I have in a form two combo boxes that have the exact itemssource property. Both combo boxes need to be sorted, but in two different ways. One is sorted by the ID (numeric), the other one by Name(Alphabetic). Is it possible to do such a thing? Thanks ...

Is INotifyPropertyChanged supported by Mono?

I'm currently developing an application that should be able to run under the standard .Net Framework as well as under Mono. I was wondering if I could safely implement INotifyPropertyChanged in my business model and that the Mono Framework would pick it up without extra effort? Is the support of data binding good enough in the Mono Fram...

.NET Formatting strings - good practices for commenting?

Before .NET, we had our own phrase localization system and we built in a way for comments to be nested in the formatting string like: "{0:price}". I'm finding that I miss this more and more as the years go by. It doesn't appear that there is a way to document formatting strings in situ like this in .NET: string.Format("{0//numerator} ...

What would cause ANY .NET application to crash immediately... except a project I create and Debug inside Visual Studio?

My software recently got deployed to a customer who said that the application was crashing immediately after it started. After some initial debugging, the customer provided me remote access to one of the computers which was unable to run the application. I found that the crash wasn't specific to my application. Any application which d...

drop down .net c#

I have a drop down that is NOT keeping the value that I select. I already check to True the EnableViewState and nothing yet. What may be missing here? Any advise is appreciated. ...