.net

How do i automate the branch/new team build process in TFS

We make a release branch from trunk at the end of each sprint. This is a manual job; we branch the src and manually edit the build config. This has proved to be an error prone process. Is it possible to automate it in TFS? ...

How to know when an asynchronous call really begins?

I want to be able to measure the time it take to execute an asynchronous method. When I call the method synchronously, I run the following code and I get the exact amount of time it took a the method MyMethod. for (int i = 0; i < 5000; i++) { stopWatches[i].Start(); webService.MyMethod(new Request()); stopWatches[i].Stop()...

C# synchronous process starting

I'm attempting to start a process from a piece of code but I want the code to pause execution until the process finishes and exits. Currently I'm using the System.Diagnostics.Process.Start() class to start (specifically) an uninstaller program, and the code executing afterwards does rely on the installer uninstaller finishing before it ...

How do you version service pack or hot fix?

If your application has a public API that people develop against then what do you do in following scenarios? If you publish service pack of your application do you change the version number of assemblies? Similarly do you change the version number if you provide a hot fix? If you do, do you provide policy files for assembly redirecti...

How to change Column Properties In SQL?

I have many tables; each has a primary key which is an Identity column with a seed of 1. I have another program which converts data from a previous database (dBase) to sql. This programs needs Indentity = No. How can I change Identity and Identity Seed from my code? ...

Bizarre System.Net.WebException

I have a program that makes repeated calls to a web service that works fine during the day, but during nightly builds and testing the program repeatedly throws the following exception: System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target m...

Should functions return null or an empty object?

What is the best practice when returning data from functions. Is it better to return a Null or an empty object? And why should one do one over the other? Consider this: public UserEntity GetUserById(Guid userId) { //Imagine some code here to access database..... //Check if data was returned and return a null if none found ...

DataGridView Event - which one to choose

I'm looking for an event that occurs right right after loading and after sorting. I have a piece of code that colors some of the Rows in a DataGridView control. But when I sort the style changes are lost. I need the right event to tap into to redo the coloration step after the load/sort events. Trying to right clean code ... so I was lo...

SQL Server CE rollback does not undo delete.

I am using SQL Server CE 3.5 and C# with the .NET Compact Framework 3.5. In my code I am inserting a row, then starting a transaction, then deleting that row from a table, and then doing a rollback on that transaction. But this does not undo the deletion. Why not? Here is my code: SqlCeConnection conn = ConnectionSingleton.Instance; c...

Retrieve AssemblyCompanyName from Class Library

I would like to get the AssemblyCompany attribute from a WinForm project inside of my C# class library. In WinForms, I can get to this information by using: Application.CompanyName; However, I can't seem to find a way to get at that same information using a class library. Any help you could provide would be great! ...

C# DataGridView, large cells: Content never fully visible, scrolling skips cell

I have encountered a rather nasty problem with the DataGridView control (Windows.Forms, .NET Framework 3.0) when there is a DataGridViewCell that is larger than the DataGridView itself. When the large cell is scrolled into view it displays normally, cut off at the bottom since it is larger than the view. If you scroll down further it eve...

How do I bind a list to a ddl?

I have a list and I am trying to add the data to the ddl. It returns data, (namespace.List). But there is something I am missing... any suggestions? public List<getBranch> Branch { get; private set; } ... getBranch(user.code); ddlOption.DataSource = Branch; ddlOption.DataBind(); ...

How to prevent leaving an Icon in System Tray on exit?

My program puts an icon in the system tray because the user may minimize to it. However, if the application crashes, or I stop the app from running in VS it leaves the icon in it until I hover over it with the mouse. Sometimes I'll look down there and there will be 10 or so icons. I can I make sure the icon goes away? ...

How to draw a square wave using ZedGraph?

How to draw square wave using ZedGraph? I'm thinking about something like this: My formula is: y = amplitude, if sin(x) >=0 y = -amplitude, if sin(x) < 0 In theory it should give a square wave, but gives me: ...

User Generated Hyperlinks to Files Hosted on a Network Share

My ultimate goal is to allow users to select a file from a dialog as if they are uploading a file. Instead of file being saved to the server, a hyperlink will be generated from the file's path. This hyperlink will then be used on our intranet page in order to open the file located on our network share. Is there any practical way to ac...

Calling SSIS package from .Net

I am calling SSIS package from a .Net windows UI. Both SSIS & .Net app are created in 2008. The SSIS package is stored in file system. When I ran .Net app I got error: The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no ...

Fix embedded resources for generic UserControl

During a refactoring, I added a generic type parameter to MyControl, a class derived from UserControl. So my class is now MyControl<T>. Now I get an error at runtime stating that the embedded resource file MyControl`1.resources cannot be found. A quick look with reflector shows that the resource file is actually called MyControl.resourc...

Better to use Stored Procedures or SQL in my code for working with data?

When it comes to CRUD operations and your database (SQL Server '08), is it better to write the SQL statements into your code or use stored procedures? Why? As pointed out below, I omitted LINQ as a third option. This was done because I am not familiar with LINQ. . . yet. If LINQ is a better option, please let me know what I'm missing. ...

Avoiding unnecessary boxing in DLR

I'm playing with DLR to get a better understanding of it. I'm not completely familiar yet with all its concepts and its terminology so sorry for any terminological or conceptual mistakes in my question. Basically, the way I understand it is that you pass around objects in expression trees but you use binders in order to expose your obj...

Asynchronous Web Service Design Patterns

When writing a Silverlight app hooked up to a WCF Web Service, the only option we are presented with in using the Web Service is to make asynchronous calls to the WS interface. i.e. WebService client = new WebService(); client.ServiceMethodCompleted += new EventHandler<Args>(client_Handler); client.ServiceMethodAsync(); client.close()...