.net

What do I need to do to set up Visual Studio to be able to manipulate an Excel File?

Let's say I want to find the value of a cell in an Excel file. In VBA, I would do this: Dim varValue As Variant Dim wb As Workbook Dim ws As Worksheet Set wb = ThisWorkbook Set ws = wb.Worksheets("Sheet1") varValue = ws.Range("A1").Value How do I set up a Visual Studio project so I can access and modify an Excel file in C# rather tha...

Update UI from multiple worker threads (.NET)

I have a pet project that I'm working on that has multiple worker threads. Outputting everything to the console is getting hard to follow, so I want to develop a UI that will have one output area per thread. I want to know the best way for the threads to send updates to the UI. I have two ideas: 1) Have each thread set a "DataUpdated" f...

Automatically increment AssemblyFileVersion on build ?

I'd like to automatically update the AssemblyFileVersion on each build, though not the AssemblyVersion. Is there any easy way that don't require every developer to install the MSBuild community tasks ? (I'd basically like AssemblyVersion("1.0.*") but for the AssemblyFileVersion ) ...

Linq where column == (null reference) not the same as column == null

I came across a rather strange problem with linq-to-sql. In the following example, var survey = (from s in dbContext.crmc_Surveys where (s.crmc_Retail_Trade_Id == tradeId) && (s.State_.Equals(state)) select s).First(); If tradeId is null, it doesn't behave as if I h...

is there and SPY++ for viewing .NET Framework messages only?

Hi, is there any good program for viewing functions / messages that are being executed on the .net framework in the background? i'm looking for something similar to what spy++ is doing, just for .NET only. I have some weird behavior that i need to understand what causing it, and i don't think on any better alternative. Thanks ...

.NET inheritance: suppress a property from the base class

Consider the Employee, Manager, and Assistant classes: public class Emp { public string Name { get; set; } public Manager Manager { get; set; } public Assistant Assistant { get; set; } } public class Manager : Emp { } public class Assistant : Emp { } The goal is to DISALLOW a piece of code to access a property like this...

C# How can false == true ? See Picture

I just ran into one of the most mind boggling errors ever. false == true What information would you guys need to confirm/debug this behavior? I've never seen anything like it. VS2008 sp1 Debug Mode | Any Cpu IIS 7.5 Edit: I did a clean->rebuild and still the same. Here's the assembly and registers. I don't know how to read t...

How to delete an asociated object in Entity Framework without having access to the object context

Having two models, Site and Link, where a site has many links, how do I delete a link from inside a method of Site, which doesn't have access to the object context? I've tried something like: public void DeleteFirstLink() { var link = LinkSet.First(); LinkSet.Remove(link); } but it seems that is not really deleting the link, ...

Continuous Integration of Git on Windows

Hey All, assuming I'm running a small shop (3 devs) and using a Windows 7 machine as a centralised Git and IIS server what is the easiest way to get CI up and running? This must be locally hosted CI (no github, no remote servers). I'm doing C# .Net development with Visual Studio 2008. Any help on getting this running with the minimum...

DLLs not being found in .NET project

I have a project that uses a few 3rd party DLLs, and am working on the setup project for deployment. The program runs fine when running (debugging) from within Visual Studio 2005, but does not when "installed". The DLLs get copied to the application folder correctly. My understanding is that the DLLs are not being registered by the in...

LINQ join with filter criteria

How is something like this done in linq? It has filter criteria on the JOIN. This is taken from this question: http://stackoverflow.com/questions/1401889/sql-filter-criteria-in-join-criteria-or-where-clause-which-is-more-efficient select salesman.salesmanid, max(sales.quantity) from salesman inner join sales on salesman.salesmanid =sa...

Visual Basic .net - Call Procedure from a variable name

Is there a way to call a procedure in Visual Basic (.net) with a variable name? For example, the variable strColour can be one of 10 pre-defined values, green blue black white red pink orange yellow indigo purple. How to handle each one is in it's own Sub Routine, colgreen, colblue, colblack and so on. I can use a bunch of if..then..e...

ASP.NET: Code behind or no code behind?

Why would anyone want to not use a code behind file so that server sided code is separated from markup? Wasn't that supposed to be one of the advantages of .NET over classic ASP? Personally, I think mixing code with markup makes the code a lot harder to understand. I hate to see those darn <% %> (server sided blocks) inter-spliced in ...

REGEX for password validation

min 3 letters max 15 characters A-Za-z0-9 special charaters @#$%^&+= This is what I have: Regex.IsMatch(Password.Text, @"^[A-Za-z0-9@#$%^&+=]{3,15}$ ") It always returns false. Please help. ...

XAML foreach() Error Object reference not set to an instance of an object.

I have a strange XAML Error that comes up in Visual Studio. I have Isolated it to the code below which causes it. The XAML designer errors when the converter below is used, however the application runs just fine without error. I like to keep the code tidy and remove all warnings and errors, what do I need to do to get rid of this one? ...

.net publish to prover creates 'unwanted' role.

I am using the publish to provider feature in .net 2008 to produce a database creation script. In the script exists the following line: /****** Object: Role [srvTTAS] Script Date: 01/20/2010 09:14:14 ******/ IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'srvTTAS') BEGIN IF NOT EXISTS (SELECT * FROM sys.databas...

Silverlight -> WCF -> Database -> problem

Hi there, I have some silverlight code that calls a WCF service which then uses the Entity Framework to access the database and return records. Everything runs fine but ... when I replace the Entity Framework code with classic ADO.NET code I get an error: The remote server returned an error: NotFound When I call the ADO.NET code ...

Moving Current execution position in an ASP.NET project

I'm not sure why but in my asp.net project in this code block when i get an exception on GetRequestStream() i cannot move my cursor to another point in the function as i normally do when i get a function. The reason is Unable to set the next statement to this location. The next statement cannot be set to another function. Is there some...

How to make combobox remeasure item height?

Hello, I am creating a custom combobox which can draw separators. So, I override OnDrawItem() and OnMeasureItem() methods. The problem is that OnMeasureItem() is called only once when datasource is changed. So if I want to specify a separator item later I need to remeasure it's height (because items with separator should be taller), but ...

ODBC Support for Informix Serial and BigInt Data Types

I have Informix Dynamic Server 11.50 and Informix Client SDK 3.5 installed on my server. I am developing a .NET application to read data from Informix database using ODBC functions. In the database, i have a table with columns of Serial and BigInt data types defined. My data retrieve function looks like this. Dim cmd As New Odbc.Od...