Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

Bonnie Berent's Tips
Bonnie DeWitt, January 1, 2007
Great tips for .NET developers
Summary
Great tips for .NET developers
Description

Resizing An Array
Resizing an array is pretty painless in .NET 2.0 (the command was not available in 1.1):
Array.Resize(ref myArr, myArr.Length + 1);

If an array has been initialized and is then resized smaller than it's original size, and then resized back up again, the values will have been lost. This makes sense when you think about it, but I thought it worth mentioning.
int[] myArr = new int[5] {0,1,2,3,4};
// myArr[3] is 3
// myArr[4] is 4
Array.Resize(ref myArr, 4);
Array.Resize(ref myArr, 5);
// myArr[3] is 3
// myArr[4] will now be 0

from a solution provided by Çetin Basöz in Message #1143663

Number of Rows in a Subset of a DataTable
To get the number of rows in a DataTable is pretty straightforward, simply use the MyDataTable.Rows.Count property. But, what if you want the number of rows for only a subset of that table? That's pretty simple too:
int nSelected = MyDataTable.Select("selected = true").Length;

from a solution provided by Kevin Goff in Message #1135574

Mix-and-Match Classic ASP and ASP.NET
Calling an .asp page from an .aspx page is no problem. Unless you are trying to share state between the two. However, there are workarounds. The author (Sidney Forcier) of the following article mentions three.

Sharing Session State between ASP and ASP.NET

The first involves parsing the session information out to hidden form fields on a "Classic" intermediate page and then submitting the page to a .NET intermediate page that loads the form fields into the session state.

The second comes from Billy Yuen at Microsoft using Microsoft .NET Framework classes and the serialization feature of the .NET Framework. His solution can be found here. However, it may not work for everyone (at least Mr. Forcier says that he could not get it to work for him).

The third workaround, developed by Mr. Forcier, involves writing the session information to a database.

from a solution provided by Victor Campos in Message #1053517

Execute VB script in a Form
To execute a VB script, use the following code:
System.Diagnostics.Process.Start("C:\somescript.vbs");

from a solution provided by Paul Chase in Message #1046189

Bonnie DeWitt, Geneva Systems Group
Bonnie is currently one of the principals of Geneva Systems Group. Call her the Senior Software Engineer, or even call her the VP of Engineering. She has no official title at the moment. Bonnie has been writing software in various languages for about 30 years. Bonnie's current focus on C# .NET applications began in early 2002. She has been a Microsoft C# MVP since Oct 2003 and an active member of the .NET online community.
More articles from this author
Bonnie DeWitt, September 1, 2005
Great tips for .NET developers
Bonnie DeWitt, October 1, 2005
Great tips for .NET developers
Bonnie DeWitt, November 1, 2005
Great tips for .NET developers
Bonnie DeWitt, December 1, 2005
Great tips for .NET developers
Bonnie DeWitt, April 1, 2009
Great tips from the .NET developer community compiled by Bonnie Berent.
Bonnie DeWitt, February 1, 2006
Great tips for .NET developers
Bonnie DeWitt, March 1, 2006
Great tips for .NET developers
Bonnie DeWitt, April 1, 2006
Great tips for .NET developers
Bonnie DeWitt, May 1, 2006
Great tips for .NET developers
Bonnie DeWitt, June 1, 2006
Great tips for .NET developers
Bonnie DeWitt, July 1, 2006
Great tips for .NET developers
Bonnie DeWitt, August 1, 2006
Great tips for .NET developers
Bonnie DeWitt, September 1, 2006
Great tips for .NET developers
Bonnie DeWitt, October 1, 2006
Great tips for .NET developers
Bonnie DeWitt, November 1, 2006
Great tips for .NET developers
Bonnie DeWitt, December 1, 2006
Great tips for .NET developers
Bonnie DeWitt, February 1, 2007
Great tips for .NET developers.
Bonnie DeWitt, March 1, 2006
Great tips for .NET developers.
Bonnie DeWitt, April 1, 2007
Great tips for .NET developers.
Bonnie DeWitt, March 1, 2007
Good tips for .NET developers.
Bonnie DeWitt, May 1, 2007
Great tips for .NET developers.
Bonnie DeWitt, June 1, 2007
Great tips and tricks for .NET developers.
Bonnie DeWitt, July 1, 2007
Great tips for .NET developers.
Bonnie DeWitt, August 1, 2007
Great tips for .NET developers
Bonnie DeWitt, September 1, 2007
Great tips for .NET developers.
Bonnie DeWitt, February 1, 2008
Great tips from the Universal Thread .NET community.
Bonnie DeWitt, March 1, 2008
Great tips for .NET developers selected from the community by Bonnie Berent.
Bonnie DeWitt, April 1, 2008
Great tips from the .NET developer community compiled by Bonnie Berent.
Bonnie DeWitt, January 1, 2006
Great tips for .NET developers