.net

Inheritance / Architecture

Hi all, Looking for some guidance on how to structure/architect an app and I'm having some difficulties. Please feel free to NOT limit answers to tech details, as I'm not sure I'm doing things the most efficient way. I'm giving examples in VB.NET, but please feel free to use c#, as that's our official target language. I just know vb be...

Where to start to build .NET Multiuser Chat Application?

Hello, Which .NET namespaces should I be looking at if I'd like to start writing a very simple chat application (in C#)? Please let me know if there's a way that I can clarify or expand on this to make it a more precise question. Thanks, Adam ...

Avoid XAML Code Duplication

I am very new to WPF. The UI I was required to implement makes use of buttons that contain both an image and a textual label. Creating one of these buttons is straightforward: I set the button's content to a UniformGrid and drop an image and a label into the grid. However, since there are quite a few of these buttons in my GUI, how do I...

How can i get the location of the GAC using C#?

Hi, How can i get the location of the GAC directory using C#? Exist an entry in the Windows Registry? UPDATE I need the location because, i want to enumerate and analize the assemblies located in the GAC. Bye. ...

What features would you like added/changed in the .NET Framework?

Over the years I have found myself being limited by what's available in the .NET framework, and having to work-around the stuff that isn't there. This seems ludicrous to me because there are so many controls available on the internet, and us developers always seem to be solving the same problems over and over. For example I recently nee...

Modfying a collection (Generics) in a persistent object leads to exceptions or loss of data

What I have? An object that is saved in a static variable and called whenever needed This object interfaces with another application. I have two collections (Generic Lists) in this object Logs And "Data That Is PreFeteched" to be used later Problem is when more than one person is trying to use this object (the object interfaces with...

Is Float really missing from HtmlTextWriterStyle?

Is float really missing from HtmlTextWriterStyle? I rarely use Control.Style.Add(HtmlTextWriterStyle.Whatever, "myval"); to set styles for elements, but occasionally I have to create a dynamic element from code-behind and I'll throw in a style via this method, to test out some styling. Today, I tried to set float:left; and was ...

What are the important threading API calls to understand before writing multi-threaded code?

Recently I was blogging about the oft over-used idea of multi-threading in .Net. I put together a staring list for "APIs you should know first": Thread ThreadPool ManualResetEvent AutoResetEvent EventWaitHandle WaitHandle Monitor Mutex Semaphore Interlocked BackgroundWorker AsyncOperation lock Statement volatile ThreadStaticAttribute ...

Strange .NET ListView behaviour

I'm trying to get my head around this behaviour: I have a ListView on a form in LargeIcon View (System.Windows.Forms.View.LargeIcon) This line is in the constructor: this.listView1.LargeImageList.ImageSize = new Size(32, 32); And then this function is called upon a double click: private void listView1_DoubleClick(object sender, Even...

Converting C# console app to VB.NET and VBA

I have to convert a C# project to VB.NET and VBA. It's a console app that uses the Microsoft Office API (Microsoft.Office.Interop.*). My two questions: C# -> VB.NET: .NET Reflector is a good tool for this, except that it doesn't preserve source code comments. Is there a way to do this? .NET -> VBA: is there an automated tool to do thi...

How do I publish a ClickOnce application using Microsoft.Build.BuildEngine

I have a WPF, ClickOnce application that I am trying to build using the Microsoft.Build.BuildEngine. I believe my question actually boils down to "how do I do the command line /target:publish using Microsoft.Build.BuildEngine"? I've tried the following projectToBuild.SetProperty("PublishUrl", myPublishUrl); projectToBuild.Targets.Ad...

.Net KeyEventArgs return vs enter

Have this in a c# .net application: string key = e.KeyCode.ToString(); in .net 1.1 key = "enter" in .net 3.5 key = "return" my question is why are they different? ...

Listview filling issue

I need to know what are the things going on here.Actually my aim is to add a column additionally and display the contents.I Added column but i want to know the codeflow required to finish to display items in that column ManagedDeviceCollection list = new ManagedDeviceCollection(); try { if(SpoServer == null) return; _lis...

ProviderException: InvalidCastException

Few of our clients are regularly getting invalid cast exception, with variations i.e. InvalidCastException / ProviderException, but both generating from method call: System.Web.Security.SqlRoleProvider.GetRolesForUser(String username) The other variation is: Exception type: InvalidCastException Exception message: Unable to cast o...

How do I control where the output of a ClickOnce application is built (using Microsoft.Build.BuildEngine) to?

I have a ClickOnce WPF application that I am using Microsoft.Build.BuildEngine to build. Everything appears to be working correctly, but when doing a targeted build to publish the application it is putting the published output to .\bin\Release\app.publish This is despite setting the properties "PublishURL", "OutDir", "WebProjectOutputD...

diassemble managed code issue

Hello everyone, I am using Windbg to diassemble managed code (written in C#, console application) using Windbg's !U command from sos.dll. I find when using !U to diassemble a managed function, the diassembled IL code only contains function calls I made, and for remaining parts (non-function call C# code), for example a=a*2, and foreach ...

Application Role connect to SQL Server with "Login Failed" error

Hi all I have a program which would use the Application Role to write data to a SQL Server 2005. using (SqlConnection sqlCon = new SqlConnection(connectionString)) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlCon; sqlCommand.CommandTyp...

MVC: How to have a View display from within a div

Hi there, In my MVC project indide one of my views I have some JQuery that pops up a dialog whos content is defined within a tag Is there a way that I can ensure the contents of the is a View/PartialView which is populated from my controler along the lines of: public ActionResult PopulateDivContent() { MyBusinessEnti...

Creating Uri from base and relative parts - problem with trailing slash

Hi! I am having a problem with Uri constructor. Results differ on whether base path ends with slash or not. var baseWithSlash = new Uri(@"c:\Temp\"); \\ "StackOverflow colorer workaround :) var baseNoSlash = new Uri(@"c:\Temp"); var relative = "MyApp"; var pathWithSlash = new Uri(baseWithSlash, relative); // file:///c:/Temp/MyApp va...

When/Where we use VMware and .net combination?

Hi all, I heard that the combination of VMware and .net application(Web) but dont know why this combination? Does any one have the idea about when and where we use these combinations.? Edit: There are some advantages of running your webserver in a virtual machine.. what are they? ...