.net

Distance (feet, inches) class or struct

Does anyone know of any examples or code that shows a class or struct that can be used for distance like the DateTime struct? I need to be able to add, subtract, and display the data in feet and inches and using conversion methods just gets messy. A class or struct would be perfect, but I came across nothing in my searches. ...

How to raise an event (particularly with an anonymous handler) only once in .NET?

I am using an event-based API and want to have a certain event handling method be called only once. (Note that I have another method which is always handling the event, but I want to add another handler for certain situations and have it only execute once.) Is it possible/encouraged to unsubscribe from an event inside the event handler?...

.NET C# running application from UNC results in error

I have an application which does not read ANY files from the local disk or does not try to write anything. It runs perfectly on the local filesystem, but it needs to run on a few 100 workstations, so I put it on a share on a Win2003 server. But when I try to start it on a XP workstation from the UNC: system.io.fileloadexception What ...

Use WCF to implement services according to industry standard?

Hi. I am looking for a proper framework to implement the (web)service tier in .NET. I am a little bit familiar with WCF and wondering, if it can be customized the way I want it. 1)There is an industry standard for messages to be sent/recieved by the system, which defines the operations, types used, etc. It is XML based. It requires all ...

System.Collections hashtable - searh for most recentle added match

I have a hashtable with id-name value pairs. the id is entered as the key, and the name as the value. I am then searching the table, and returning the key whose value matches a specified string like this: (folderValue is the specified string) String^ key; for each (String^ aKey in table.Keys) { if ((String^)table.default[aKey] == fo...

NotifyIcon not firing double-click event

I have a double click event for a notify icon that will bring up my main form. The double click event isnt firing. Even if I put a breakpoint in the code it never gets executed. Here is what I have so far: Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles Me.FormClosing Me.WindowState =...

asp mvc 2 structure map not working when deployed.

I'm using structure map in my asp mvc site, which i've just tried to deploy onto II6 for the first time. The basic dependency structure is very typical: public ControlMController(IControlMService controlMservice) { this._controlMservice = controlMservice; } ... public ControlMService(IControlMRepository re...

Difference between ASP.NET and .NET framework version

I realize this is probably a hopelessly newbie question, but what is the difference between the ASP.NET version and the .NET framework version? I am making an asp.net site using the .net 3.5 framework, but when I echo this; System.Environment.Version.ToString() I get "2.0.50727.4927". Is this then an ASP.NET 2.0 site? This seems odd...

Same source, multiple targets with different resources (Visual Studio .Net 2008)

A set of software products differ only by their resource strings, binary resources, and by the strings / graphics / product keys used by their Visual Studio Setup projects. What is the best way to create, organize, and maintain them? i.e. All the products essentially consist of the same core functionality customized by graphics, strings...

HtmlElement from a WebBrowser object strips double quotes from HTML

I am grabbing an HTMLElement from a browser object and then using getElementById to grab the element I want. When the element is grabbed into the HtmlElement object double quotes around attributes like <input type="checkbox" name="test1" /> becomes <input type=checkbox name=test1>. It is removing the double quotes and backslash from th...

Cancel NamedPipeClientStream.Read call

I've looked around all over the web, but I can't find an answer to the following question. I have a C#/.NET NamedPipeClientStream instance in a client program, and a worker thread is calling NamedPipeClientStream.Read(byte[], int, int) to get data from a server. The server sends data updates to the client. Read is a blocking call. If...

How to update entity from new created detached entity

Let's say I created a new product like this: Product p=new Product(){ Id= 2,Name="some name"}; My product variable has never been attached to a data context, how can I attach this entity so that my existing product in the database with Id=2 gets update with the name of my detached product? ...

asp:FileUpload.FileBytes example in MSDN confusing

I was just going to use the FileUpload.FileBytes property but looking into the respective example in the MSDN library I'm confused about this part: int fileLen; // Get the length of the file. fileLen = FileUpload1.PostedFile.ContentLength; // Create a byte array to hold the contents of the file. byte[] input = new byte[fileLen - 1]; i...

Few confusing things about locks

I know how to use locks in my app, but there still few things that I don't quite understand about locking ( BTW - I know that the lock statement is just a shorthand notation for working with Monitor class type ). From http://msdn.microsoft.com/en-us/library/ms173179.aspx: public class TestThreading { private System.Object lockTh...

How do processes work with windows services?

I have a widows service that is scheduled to run every hour or so. It basically calls a static method in a referenced assembly. My concern is that the method wont finish running during the hour period, so if it is overlapping it will cause some problems, im using lock statement around the method body. my question is this... will the ...

C# WPF - Application Icon + ShowInTaskbar = False

I've created a custom layered WPF window with the following properties: AllowsTransparency = True ShowInTaskbar = False Background = Transparent Topmost = True Icon = "Icon.ico" I've added Icon.ico under "Project Properties"->"Application" tab. The icon displays as the default WPF window icon if ShowInTaskBar is false, but displays ...

How to connnect GridView DataSource over Webpart class?

i try to make myGridView Companent via using WebPArt you know it : using System.Web.UI.WebControls.WebParts; using System.Web.UI.WebControls; using System.Web.UI; namespace MyGridView { public class MyGridView : WebPart { GridView gv; protected override void CreateChildControls() { gv = n...

Best method for using existing .NET pages to update a portion of another page

I'm working on an ASP.NET WebForms CMS application, and having a bit of trouble solving a particular problem. For a while now, I've had a menu on the side of the admin console that shows a list of the pages, links, etc that make up the sitemap. Users could click on an entry, bringing up a flyout menu at the point of the mouse click. T...

How to animate an object to the Center of a fluid layout in Silverlight

Hi and thanks for reading. I am building a simple silverlight page and having difficulties animating elements to the center the screen. The example... MouseLeftButtonDown > animate the rectangle to the center of the screen. Is there a way to do this? ...

Why are array initializers only allowed for arrays?

This does not compile. Dim Tom As New List(Of String) = {"Tom", "Tom2"} This does Dim Tom As String() = {"Tom", "Tom2"} IMO this features should be allowed for all collection types and not only arrays. ...