Wednesday 23 July 2008

Visual Source Safe Useful Links


• Share a project in VSS with other VSS projects.
http://www.softsteel.co.uk/tutorials/vss/index.html
• Drag files to share into a project in VSS Explorer, or Versions -> Share.


• Virtual Rollback
http://blogs.msdn.com/korbyp/archive/2003/05/30/53992.aspx


• Force comments possible only with 3rd party add-in.
http://forums.msdn.microsoft.com/en-US/vssourcecontrol/thread/281f0099-1925-4bc3-892e-e78d1881cc3b/


• Pinning
http://www.sharpdeveloper.net/content/archive/2007/06/12/visual-source-safe-pinning-feature.aspx
• Go to File History to Pin a Version.

Monday 14 July 2008

Edit and Continue debugging

With Edit and Continue for C#, you can make changes to your code in break mode while debugging. The changes can be applied without having to stop and restart the debugging session.

Edit and Continue is invoked automatically when you make changes in break mode, then choose a debugger execution command, such as Continue, Step, or Set Next Statement, or evaluate a function in a debugger window.

Note
Edit and Continue is not supported when debugging 64-bit code, the Compact Framework, optimized code, mixed native/managed code, or SQL CLR code. If you try to apply code changes in one of these scenarios, the debugger puts up a dialog box explaining that Edit and Continue is not supported.


To invoke Edit and Continue automatically
In break mode, make a change to your source code.

From the Debug menu, click Continue, Step, or Set Next Statement or evaluate a function in a debugger window.

The new code is compiled and the debugging continues with the new code. Some changes are not supported by Edit and Continue. For more information, see Supported Code Changes (C#).

To enable/disable Edit and Continue
On the Tools menu, click Options.

In the Options dialog box, expand the Debugging node, and select Edit and Continue.

In the Options dialog box Edit and Continue page, select or clear the Enable Edit and Continue check box.

The setting takes effect when you restart the debugging session.


Link

http://msdn.microsoft.com/en-us/library/ms164926(VS.80).aspx

Friday 11 July 2008

.Net Surround With Snippet File

How to create a .Net Surround With Snippet.

1.

On the File menu, click New and then click File.
2.

Click XML File and then click Open.
3.

On the File menu, click Save .
4.

In the Save as type box, select All Files (*.*).
5.

In the File name box, enter a file name with the .snippet file name extension.
6.

Click Save.

Code Example....


<?xml version="1.0" encoding="utf-8" ?>

<CodeSnippet Format="1.0.0">

<Header>

<Title>TestJo</Title>

<Shortcut>TestJo</Shortcut>

<Description>Expansion snippet for TestJo</Description>

<SnippetTypes>

<SnippetType>Expansion</SnippetType>

<SnippetType>SurroundsWith</SnippetType>

</SnippetTypes>

</Header>

<Snippet>


<Code Language="csharp" Format="CData">

<![CDATA[

try

{

$selected$$end$

}

catch

{

throw(ex);

}

]]>

</Code>

</Snippet>

</CodeSnippet>




I think the best thing to do is add the folders into code manager rather than using the imports button. This means that you will always access the updated version of the snippets.

Open Tools >> Code Snippets Manager
Press Add.
Browse to the first folder above.
Repeat for second folder.
Access by:
Right click and select insert snippet or surrounds with.
Type the name of the snippet and intellisense will pick it up, and then press tab.

Wednesday 9 July 2008

Setting all Columns Read Only value

There are occasion where we may want to set all read only properties of our data columns to false or true. When we instantiate our dataset using our Dal.GetSchema() method it can set certain fields to ReadOnly, when we actually want to write to them at the front end. Here's a function to change this.

///
/// Set all columns property readonly to false
///

private void SetReadOnlyFalse(DataSet ds)
{
foreach (DataTable dt in ds.Tables)
{
foreach (DataColumn dc in dt.Columns)
dc.ReadOnly = false;
}
}


Note that we can easily change the code to make the entire Dataset readonly.

///
/// Set all columns property readonly to true
///

private void SetReadOnlyTrue(DataSet ds)
{
foreach (DataTable dt in ds.Tables)
{
foreach (DataColumn dc in dt.Columns)
dc.ReadOnly = true;
}
}

Or we could pass a parameter to our function to allow us to use one fucntion for both operations.

///
/// Set all columns property readonly to the boolean blReadOnly
///

private void SetReadOnly(DataSet ds, bool blReadOnly)
{
foreach (DataTable dt in ds.Tables)
{
foreach (DataColumn dc in dt.Columns)
dc.ReadOnly = blReadOnly;
}
}


Please note that the code for the Dal.GetSchema just returns an empty dataset structure for a set of table from our SQL server database. The code discussed here will work for any dataset in .Net

Friday 4 July 2008

FTP Batch File

Windows has a built in FTP client that can be used to transfer files using a DOS batch file.
This can be used in DTS packages.

To run the FTP client you pass in a batch file containing the FTP access details, change directory command if need and the files to transfer.

Text file commands:

open servername
username
password

cd /data/ftp
put c:\filetotransfer.txt
put c:\otherfiletotransfer.txt
quit

Run the FTP client with the following commands:

cd windows
ftp -s:c:\textfilecommands.txt

For more info:
http://www.computerhope.com/software/ftp.htm

Wednesday 2 July 2008

CSS Properties Window

Guys - i have found this really handy tool for Visual Studio 2005, i have just downloaded it and it looks good - saves jumping between the pages - let me know what you think?

http://www.asp.net/downloads/sandbox/css-properties-window/

Overview

Visual Studio 2005 provides some capabilities for visually editing the styles for elements in an HTML or ASP.NET page. For example, in Design view, you can right-click a control or element, and then choose Style to display the Style Builder dialog box. Although the style builder enables you to create and edit in-line styles, there's no way to edit the styles that are inherited from a linked style sheet. The new CSS Properties window provides this capability � it enables you to edit both in-line styles and styles in linked style sheets.
Free Hit Counter