.net

How to add a css reference within a server control ?

Hello everyone, I've built a custom server control that uses custom CSS. The problem that I have is that I have to set a reference to the css file on each page I use the control. Can I set this reference inside the control ? So that I could just add the control and not worry about the reference. ...

Does SqlCommand optimize parameterized sql statements?

I know in Java, when using PreparedStatement with parameters, some JDBC drivers will optimize the SQL queries by turning them into stored procedures so that all the subsequent calls will run faster. Does SqlCommand provide such optimization when accessing MS SQLServer? ...

How can I lock Application.OpenForms?

Hi, I am writing a simple framework for testing WinForm apps, which is running in process. I am using Application.OpenForms to find the control I need to change in the current test step. However, I am sometimes getting errors that the collection was modified (probably by some other thread). How can I lock this collection, to make sure t...

Possible to export content generated by a Web WYSIWYG editor to MS Word

Hi In our project we work a lot with both HTML and MS Word. The users create "documents" in their browsers and when they are finished they export these documents to MS Word using the DocX library (http://docx.codeplex.com/). This works fine when we only handle text. What we want to do now is to let the user format the text that is ente...

System.Net.Sockets.SocketException

I have an application that makes a sync request on an external resource via http(s). Every few weeks I get the following exception Exception: System.Net.WebException - Message: Unable to connect to the remote server Inner Exception: System.Net.Sockets.SocketException - Message: A connection attempt failed because the connected party ...

Best .NET library for trees

What is the best .NET library (commercial or open source) that implements a non-binary tree and its associated operations? The requirements are to dynamically insert and delete nodes, copy/paste nodes, find information buried in nodes, copy/paste of folders and their children from one area of the tree to another. The tree is at the busin...

Application.OpenForms equivalent that works if the process runs as service?

Hi, I am trying to run some UI tests as part of the build. I am using Application.OpenForms property to find custom dialog boxes, and it works fine if I run the tests manually. However, this property doesn't contain these forms when I run the same tests as part of the automated build (so it runs as a child process of a windows service an...

.NET SQLite and Click-Once Deployment

Have a smartclient application that is distributed using Click-Once, but also includes a SQLite DB for a local cache. The problems is that once the app is published it doesn't seem to be able to open the SQLite DB file. Have included the DB file as part of the install process... Any thoughts? ...

Set RTF text into WPF RichTextBox control

Hi, I have this RTF text: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;\red255\green0\blue0;} \viewkind4\uc1\pard\qc\cf1\fs16 test \b bold \cf2\b0\i italic\cf0\i0\fs17 \par } How to set this text into WPF RichTextBox? Solution: public void SetRTFText(string ...

Best practice to detect a client disconnection in .NET ?

I'm developing a server in C# which can accept only one client and I need to know when this client is disconnected to be able to accept another connection requests. I'm using a first Socket which continuously listen to connection request with Socket.BeginAccept and accept or reject clients. When a client is accepted, the new Socket whic...

Join xml files with XmlReader

I am joining 3 xml logfiles with LINQ to XML by id, but when my logfiles become too big, LINQ to XML doesn't work anymore, so i have to use XmlReader. But now I am asking myself how to do this? Should i loop through every document for each id, or is there a more simple elegant solution? Anybody? ...

How can I check if a Win32 Window pointer is a valid .Net Control?

How can I check if a Win32 Window pointer is a valid .Net Control? ...

How can I get the accessible name using win32 from c#?

How can I get the accessible name using win32 from c#? (the accessible name was set using the standard win form designer) ...

C# Object/Class-Debugging-Library (to HTML/String)

Does anybody know a class, that writes the structure(public (static, instance) members)/data of an object/class to string (for debugging-purposes) or even generate fancy html-divs or something like that? ...

How do I install a Debugger Visualizer?

I'm trying to use Mole for Visual Studio but it's not loading. I've had this issue before with other visualizers so I'm probably missing something obvious. I just copied the DLL (Mole.Visualizer.dll) into the following folder and restarted VS2K8: C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers ...

What's the difference between KeyDown and KeyPress in .NET?

What is the difference between the KeyDown and KeyPress events in .NET? ...

Where do Label_ markers come from in Reflector and how to decipher them?

I'm trying to understand a method using the disassembly feature of Reflector. As anyone that's used this tool will know, certain code is displayed with C# labels that were (presumably) not used in the original source. In the 110 line method I'm looking at there are 11 label statements. Random snippet examples: Label_0076: if (enume...

.Net Configuration Editor problem

I have added some settings to my c# application using the configuration editor. There are three configuration items; two of type string and one of type int. All three have Application scope. When I compile my application the exe.config file contains two subsections under <applicationSettings>. These are <appName.Settings> containing all...

Finding current directory during Visual Studio debugging session?

How can I find the current directory for a .NET application running under the Visual Studio debugger? Update 1. To be clear: I don't want to change the code or get information in the program itself - I just want to get information about the application currently being debugged. While debugging a .NET Winform application (mixed VB.NET a...

Update primary key value using entity framework

I'm trying to update one value of a compound primary key from within the entity framework and I'm getting this error: "The property 'CustomerID' is part of the object's key information and cannot be modified. " Here is my code: Dim customer As Customer = (From c In db.Customer Where c.CustomerID = "xxx" AndAlso c.SiteKey = siteKey).Fi...