.net

Master-Slave control architecture in .net across multiple systems.

I've been analyzing my next project and writing up requirements, one of the things I'd like to do involves me communicating over 64 serial ports (16 ports x 4 windows pc's) The best was I can think to do this is a master/slave application model where the master application is controlled by an operator and the slaves simply execute comma...

What is an interface that specifies an enumerable Windows control?

I have a method that validates a combo box control like so: Public Function ValidateComboBox(ByVal objMessageMode As Errors.MessageMode, ByVal cboInput As ComboBox) As Boolean Dim blnValidated As Boolean 'no value--invalidate' If cboInput.SelectedValue Is Nothing Then Errors.InvalidateField(cboInput, Errors.errFiel...

.NET (C#) First item in excel omitted in results (DataSet, OleDB)

[Sample.xlsx] Column 0, Row 0 = "ItemA" Column 0, Row 1 = "ItemB" Column 0, Row 2 = "ItemC" Column 0, Row 3 = "ItemD" [Application] DataSet dsData = new DataSet(); string strConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Sample.xlsx;Extended Properties='Excel 12.0;'"; OleDbDataAdapter daGetExcel = new OleDbDataAdapter("SE...

Data Binding to an object in C#

Objective-c/cocoa offers a form of binding where a control's properties (ie text in a textbox) can be bound to the property of an object. I am trying to duplicate this functionality in C# w/ .Net 3.5. I have created the following very simple class in the file MyClass.cs: class MyClass { private string myName; public string M...

Generic drop down list

I want to create generic drop down list in ASP.net 2.0 using C#, basic concept is which ever Nhibernate object type with which I initialize this list it should populate dropdown with all values from that objects underlying table. Any suggestions how can I achieve this. ...

Any way to get a BITMAPV5HEADER out of a Bitmap object in C#

Is there any way to get a BITMAPV5HEADER out of a Bitmap object in C#? Or just get the values that are in their? I need to get some ColorSpace information out of a bitmap and can't see a way to do this in C#. ...

What namespace are my classes in when I don't put a namespace?

Hi, if I don't put a namespace in my classes (vs.net 2008), which namespace do my classes get built under? update Its strange, when I add a namespace I can't seem to reference the classes methods from my user control. If I explicitly set a namespace, and add a 'using ...' in my control, I still can't see it! How can this be? usi...

Attach file to Outlook

I have the below code that I harvested from MSDN. There intent there seems to have been as an Add In and as such I am having a problem with the this.Application.CreateItem(...) portion. What do I need to do differently to do this from my winform app? private void AddAttachment(){ Outlook.MailItem mail =this.Application.CreateItem(Out...

Help me get started with unit testing in Visual Studio 2008

After spending some hours reading about Unit Testing and test driven development here on StackOverflow and on other sites posts pointed me to, I know two things: I want to use it I don't know where to start There are lots of good posts here about details, best practices etc, but what I am looking for is a beginners tutorial/introduct...

OOP/OOD Book Suggestions (.NET-focused) For Office Library

Our office is about to finally spend some more money updating the in-house reference library and I suggested that we pick up some more books that focus on Object Oriented Programming/Design from a .NET perspective (which is what we focus in, primarily VB and ASP.NET). After doing a quick look through our current shelf we seem to only ha...

General purpose Try and Retry with a Timeout in C#?

I'm looking for a general purpose try and retry with a timeout in C#. Basically, I want the following: bool stopTrying = false; DateTime time = DateTime.Now; while (!stopTrying) { try { //[Statement to Execute] } catch (Exception ex) { if (DateTime.Now.Subtract(time).Milliseconds > 10000) { ...

Importing C methods/classes into a C# project

I have some c headers, and a c lib that I'd like to import and use in a c# project. How can I do this? ...

Integrating FogBugz, what kind of API/integration points does it have?

Hi, Other than logging into FogBugz and using it etc, what kind of integration points does it have? ...

For what kind of applications do you use CAS .net security features?

I'm currently reading for the mcts exam and struggle a little with the chapters on security. How common is it to use the CAS-features? For what kind of application is it used? I can't say that I have missed the opportunities this system provides when developing native applications. Is this kind of security more important for managed app...

Convert Dictionary<String,Int> to Dictionary<String,SomeEnum> using LINQ?

I'm trying to find a LINQ oneliner that takes a Dictionary<String,Int> and returns a Dictionary<String,SomeEnum>....it might not be possible, but would be nice. Any suggestions? EDIT: ToDictionary() is the obvious choice, but have any of you actually tried it? On a Dictionary it doesn't work the same as on a Enumerable... You can't pas...

Distinction between iterator and enumerator

An interview question for a .NET 3.5 job is "What is the difference between an iterator and an enumerator"? This is a core distinction to make, what with LINQ, etc. Anyway, what is the difference? I can't seem to find a solid definition on the net. Make no mistake, I can find the meaning of the two terms but I get slightly different an...

Change properties of an ASP Button depending on data bound in a GridView?

Hello, I am working on a form with a GridView, pulling data from an SQL Express database. The last column will be a Button that I want to be able to change based on what data is bound to that column. The button will act as an "Enable/Disable" toggle. Basically, if a user is enabled, I want the button to say "Disable" and have the OnCli...

Is there a correct way to dispose of a httpwebrequest?

I am using a httpwebrequest, and am disposing of the response stream. Is there a correct method of disposing of the httpwebrequest, as it does not contain a close or dispose method? ...

Create Your Own .NET Assembly Cache

Hello everyone, In a .net application I am writing, I need to locally cache assemblies from various locations so my application can use them even if the original locations are unavailable. I cannot use the GAC (primarily because I want portability and also because the assemblies might not be signed). Does anyone know of any .net cod...

How to sort an XML file using .NET?

So you have a third-party web service that likes to abuse XML and return things in an order that makes your programming a complete pain in the neck. For example... <file> <node1>Foo</node1> <price>4.99</price> <node2> <key>XX999</key> </node2> </file> There are about a thousand of these sorted in order by price. How can ...