.net

.NET TreeView won't show images

Having a problem getting a TreeView control to display node images. The code below works sometimes but fails to show any image at other times. private TreeNode AddNodeForCore(TreeNode root, Core c) { string key = GetImageKey(c); TreeNode t = root.Nodes.Add(c.Name, c.Name, key, key); t.Tag = c; return t; } Note that wh...

What is the best way to change the credentials of a Windows service using C#

I need to change the credentials of an already existing Windows service using C#. I am aware of two different ways of doing this. ChangeServiceConfig, see ttp://www.pinvoke.net/default.aspx/advapi32.ChangeServiceConfig ManagementObject.InvokeMethod using Change as the method name. Neither seems a very "friendly" way of doing this and...

System.Diagnostics.Process.Start weird behaviour.

I'm writing an application to start and monitor other applications in C#. I'm using the System.Diagnostics.Process class to start applications and then monitor the applications using the Process.Responding property to poll the state of the application every 100 milisecs. I use Process.CloseMainWindow to stop the application or Process.Ki...

How to Enable/Disable MenuItem and ToolButton together

Hi, I'm a newbie in C# bu I'm experienced Delphi developer. In Delphi I can use same code for MenuItem and ToolButton using TAction.OnExecute event and I can disable/enable MenuItem and ToolButton together using TAction.OnUpdate event. Is there a similar way to do this in C# without using external libraries? Or more - How C# developers ...

What is the salt in Enterprise Library HashProvider ? (SaltEnabled key)

How is the salt generated in HashProvider in Microsoft Enterprise Library when we set SaltEnabled? Is it random to new machines? Is it some magic number? (I know what is a salt, the question is what's the actual value of a/the salt in Enterprise Library HashProvider) ...

ASP.NET - how to show a error page when uploading big file (Maximum request length exceeded)?

Application able to record error in OnError, but we are not able to do any redirect or so to show something meaningfull to user. Any ideas? I know that we can set maxRequestLength in web.config, but anyway user can exceed this limit and some normal error need to be displayed. ...

.NET Compact Framework Can you get grids which have multi line text in cells?

Is it possible to show multiple lines of text in grid cells using the .NET Compact framework? We need to create a grid where the middle column contains an address. We'd like to show this over multiple lines and (possibly) apply some formatting to the final line. e.g. 123 Anywhere Street Birmingham B1 2DU tel: 0123 555555 ...

Problem: .NET code runs from one directory, but not another, on same disk

Our application is a hybrid Win32 unmanaged application and a .NET 2.0 managed application. The Win32 part is the main executable, which at some point loads and hosts the .NET 2.0 runtime and loads some managed modules to open new winforms windows. We've had our share of CASPOL-type problems, but today we have a very odd problem and I'm...

Resources and guides to UI virtualization in WPF

UI Virtualization is an awkward terminology that describes WPF UI controls that load and and dispose child elements on demand (based on their visibility) to reduce memory footprint. ListBox and ListView use a class called VirtualizingStackPanel by default to achieve higher performance. I found this control, which is really helpful, a v...

Specifying a non-.NET dependency in Visual Studio

Hello, I'm calling a non-.NET dll from my project using P/Invoke, meaning that the .dll must always be present in the .exe's directory. Is there any way to tell Visual Studio of this dependency, so that it will automatically copy the .dll to the output directory when compiling, and will automatically include the .dll in the setup? Or ...

What is your .NET logging framework of choice?

There are many Logging frameworks for .NET, from simple Debug.WriteLine and Trace to Log4Net, Logging application block, NLOg and others. Which one do you use or recommend, and why? Also, which one would you recommend to NOT use, and why? ...

.NET windows application, can it be compressed into a single .exe?

Hi, Not to familiar with .net desktop applications (using vs.net 2005), is it possible to have the entire application run from a single .exe file? ...

.Net Menustrip background colour range

I need to put a control to the right of my MenuStrip. The MenuStrip fades in colour away from the BackColor on the left hand side to something whiter on the right, and ideally I would like to make my small control blend in by having the same backColor as the menustrip has on that side. Does anyone know how that colour is computed? Worst...

How can I debug a C# COM assembly when it's being called from a native win32 application?

I'm developing a C# assembly which is to be called via COM from a Delphi 7 (iow, native win32, not .net) application. So far, it seems to work. I've exported a TLB file, imported that into my Delphi project, and I can create my C# object and call its functions. So that's great, but soon I'm going to really want to use Visual Studio to ...

How do I disable updating a form in WinForms ?

During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but I can't find it. Please help. ...

Visual Studio 2005 - Refactor multiple attributes in same time?

Hello, I use the right button>Refactor>Encapsultate field to have my accessor every time. The problem is when I create new class, I can have more than 10 attributes and it's long to do 1 by 1 every accessor. Is there a faster way to create them? Thank you for your time. ...

How can I make the AssemblyInfo version of a C# .NET CF program propagate to the Explorer Properties window?

It seems like if you compile a Visual Studio solution and have a version # in your AssemblyInfo.cs file, that should propagate to say, the Windows Explorer properties dialog. This way, someone could simply right click on the *.exe and click 'properties' to see the version #. Is there a special setting in Visual Studio to make this happen...

Could you explain STA and MTA?

I'm having trouble understanding STA and MTA. If you could explain it in your own words that would be great. Also what are Apartment threads and do they pertain only to COM? If so why? ...

Contextual Natural Language Resources, Where Do I Start?

Where can i find some .Net or conceptual resources to start working with Natural Language where I can pull context and subjects from text. I wish not to work with word frequency algorithms. ...

.NET client app: how to reach Web Services in case of proxy?

We are developing a .NET 2.0 winform application. The application needs to access Web Services. Yet, we are encountering issues with users behind proxies. Popular windows backup applications (think Mozy) are providing a moderately complex dialog window dedicated the proxy settings. Yet, re-implementing yet-another proxy handling logic a...