.net

What charset to use when sending a response to a javascript XMLHTTPRequest 'get' request

I want to send a response to a get request made by the javascript object 'XMLHTTPRequest.' The response content-type will be 'text/plain'. I would like to add a 'charset' to that (i.e. 'Content-Type:text/plain;charset=UTF-8') What encodings does javascript work with natively and what encodings will work with javascript on all browsers...

How can I run Microsoft Visual Studio Units Tests in an automated way using .NET code?

We have a build and deployment tool and as part of the tool before a deployment I want to validate that all of our unit tests run. I want to execute the Visual Studio unit tests using C# code if possible in some way. These tests were not built for nunit. Are there any good articles or ways of doing this that someone could recommend? ...

Setting custom data in Clipboard in a .NET Excel addin

I have a Excel addin written in C# that has some Copy/Paste processing code. When the user copies, I want to put my own TableData class object on the clipboard and retrieve it back when the user paste the data on the worksheet. Sounds real simple and I found a dozen articles online but for some reason it is not working in my code. Here ...

Font issue : Controls text cutoff in Windows 7 machine

Hello I have a Visual Studio 2008 Windows Application which typically has menu items,textboxes and some buttons on almost every other forms. It looks great on my development machine which is XP SP3. I read my AppConfig file to set the font family and font size which is common to all forms. For ex: I use the Arial 10 font to be used t...

How to add App.Config file in Console Application

I want to store the connection string and some parameters in app.config file which we generaly do for windows aplication but I can't find app.config file for console application. So how should I use this file, how to add this file or there is some other work arroud for the same functionality. I am working in console application ...

Entity Framework 4 - How to Read Multiple Record Sets From A Stored Procedure?

Hi Guys, I have a very simple stored procedure which returns multiple record sets. All of the record sets have aliased columns so they all look the same. E.g. SELECT TOP 10 FooId AS Id, Name As Name FROM Foos SELECT TOP 10 BarId AS Id, Name As Name FROM Bars ... For my EF setup, i'm using POCOs and have my own DataC...

How can I check if an event has been subscribed to, in .NET ?

Hi folks, At one point in my code, i subscribe to the following event :- UploadFolderMessageQueue.ReceiveCompleted += UploadMSMQReceiveCompleted; works great and when the Message Queue's Recieved Completed event fires, my delegate handles it. Now, I'm wanting to CHECK to see if the event has been subscribed to, before I subscribe to...

How to intert image in SQLServer uing sql query without using parameters.

I am trying to insert image in my databse .However I dont want to use the parameters as my set up of coding pattern does not allow this.Is there a way out? I know that following code inserts the image byte[] imageData = ReadFile(txtImagePath.Text); SqlConnection CN = new SqlConnection(txtConnectionString.Text); string qry = "i...

Treat events as objects

C# is still not OO enough? Here I'm giving a (maybe bad) example. public class Program { public event EventHandler OnStart; public static EventHandler LogOnStart = (s, e) => Console.WriteLine("starts"); public class MyCSharpProgram { public string Name { get; set; } public event EventHandler OnStart; publ...

File naming conventions

Hi, Please help me for the naming of the class file that defines the property of each value (Entity class). Example: for a dataset file we will use the name like this: dsxxx. But i don't know what will for entity class Please help me for that. thanks in advance. ...

How to get MAC ID of a system using C#

I am building a C# application and I want to fetch the MAC ID of the system. I have found many code snippets, but they either give wrong answers or throw exceptions. I am not sure which code snippet is giving the right answer. Can someone provide me the exact code snippet that fetches the MAC ID? ...

Effect of System.Net Connection Management

<system.net> <connectionManagement> <add maxconnection="1000" address="*"/> </connectionManagement> </system.net> Can someone tell me if this setting affects my WCF (basicHttpBinding) services? ...

Best technology to develop a photo ID card publishing software

We would like to develop a photo ID card publishing software . Objective of the Project: To develop an application with multi-language support that allows the companies to create ID cards and take prints of it. The application must facilitate the user with the preview of the actual output when designing and it can be customized. The ID ...

Layer effects (blur, etc.) in WinForms

In WinForms, I’m looking for a way to achieve the functionality similar to that of JXLayer class in Java’s Swing. To be more specific. I’d like to blur entire content of a window, and paint something over it (a waiting circle, for example). Any ideas will be highly appreciated :) ...

Entity framework 1.0 issue

Problem is it seems that when I use the code below to assign the location values obtained from a ListBox to the division being created/edited EF creates a new location and then enters that locations ID and the divisions is into the DivisionLocation table thus creating multiple locations unnecessarily, as depicted below. using (FRLEntiti...

How to make .NET not to use registered TLB to marshal calls to COM methods?

Current configuration is: The main application is unmanaged. It contains DLL, containing TLB, which describes functions, exposed to COM model. To support ASMX web services, it loads .NET framework, and starts ASP.NET domain that serves web service calls. To serve web service calls, it needs data from the main application. So, we'r...

.net connect to Sybase database,throw exception:Connection to Sybase server has been lost. All active transactions have been rolled back at

After install Sybase v12.54, I tried TableViewer app under samples folder. But got exception:Connection to Sybase server has been lost. All active transactions have been rolled back. I added 'Connect Timout=300' to the connection string, it works, but slow... What's the problem here? Thanks in advance. ...

Uncatcheable exception from MethodInfo.Invoke

Hi, I have this code which Invokes a MethodInfo: try { registrator.Method.Invoke(instance, parameters); } catch{ registrator.FailureType = RegistratorFailureType.ExceptionInRegistrator; //registrator.Exception = e; } The Registrator is just a MethodInfo wrapper, the Method property is the MethodInfo object itself. paramet...

"Unable to evaluate expression because the code is optimized" when calling method from some thread

Hi all, I encounter a strage behavior in my application. I have a function: Load with try-catch blocks in class Task. When I'm calling it from the main thread: Task.Load() it runs OK. I created a thread which runs some method. when I call Task.Load() from the thread method I receive that message: "Unable to evaluate expression because...

New to .NET - VB or C#

I come from embedded C background. I want to start .NET programming. Should I learn VB or C#? Whats the difference? ...