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

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

Getting a Unique Filename
To get a unique filename, use the following from the System.IO namespace.
string TempFilename = System.IO.Path.GetTempFileName();

This will return a unique temporary filename but be aware that it also creates an empty file on disk (zero bytes). This is okay if you are prepared to manage deletion or re-use yourself.

from a solution provided by Neil Tonkin in Message #1059053

Column Lengths in a DataSet's Schema
When filling a DataSet from a DataAdapter, column lengths are, by default, not included in the DataSet's schema.In order to get the maxLength of a string column from the database, set the DataAdapter's MissingSchemaAction property:
SqlDataAdapter da = new SqlDataAdapter("select * from bob", this.MyConnectionString);
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet ds = new DataSet();
da.Fill(ds, "MyTable");
string xml = ds.GetXmlSchema();

from a solution provided by David Stevenson in Message #1085638

Dynamically Add Control to WebForm
To dynamically add a control to your WebForm (for instance, during the Page_Load()), use either the Controls.Add(...) or Controls.AddAt(...). ie:
 
Label myLabel = new Label();
myLabel.Text = "This is added at runtime:" + DateTime.Now.ToString();
Controls.Add(myLabel);

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

ComboBox Images
The ComboBox that comes with .NET does not support images, so you have to write your own. Fortunately other people wanted images in their ComboBoxes too. Here is a link to an article that explains this and you can download the source code:
http://www.codeproject.com/cs/miscctrl/ImageComboBoxControl.asp

from a solution provided by Einar Kvandahl in Message #1121763

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, 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, January 1, 2007
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