August 2003 - Posts
Have you used Visual Studio .NET's “Clipboard Ring“ tab lately? I haven't! I was not aware of it's presence within Visual Studio .NET's Toolbar until I attended a .NET Users Group meeting the other day.
The Clipboard Ring feature has the ability to keep track of the last 10 (or so) Clipboard copies from within Visual Studio .NET. So if you copy some VB.NET (or C#) code, then copy some HTML, both of those copies will be available from the Clipboard Ring on the Toolbar.
This is very cool feature! It sure beats opening up Notepad and coping code / HTML from Visual Studio .NET into Notepad. I've been there, done that! And I won't be doing that again! Especially now that I know about Visual Studio .NET's “Clipboard Ring“ tab feature! ;-)
Have you ever tried to edit a long string value within the Properties window of Visual Studio .NET 2003? It can be very frustrating! Here is a tip that will make it a lot easier for you to edit those long property string values.
Double-click on the title bar of the Properties window. It will then become detached and float above all the other windows within Visual Studio .NET 2003. Then resize the Properties window so that the width is as wide as the screen. Then move the middle splitter bar so that you can see the property names correctly. You can now edit the long property value very easily.
To get the Property window back to it's original position, double-click on the title bar of the Properties window again. It will then be moved back to it's orginial position.
The only downside to this approach is that the middle splitter bar will not be correctly re-position when the Properties window is placed back. So you'll need to re-adjust it.
Enjoy!
Did you know you can drag file tabs around within Visual Studio .NET 2003? Try this, open up several files, then click and drag one of the tabs for an open file and move it to another position within the set of tabs. Cool huh?
You can also drag and drop tabs onto the current opened file. When you do this, a menu will pop up asking if you want to create a “New Horizontal Tag Group” or “New Vertical Tag Group”. Select one and presto, you have either a horizontal or vertical split screen with the dragged file in the upper split screen. Cool huh?
Don't forget the “Windows | Close All Files“ menu when closing several open files all at once. It sure beats clicking the small upper right X for each file... ;-)
Enjoy!
I got voted in as President of the .NET Developers Association Users Group (http://www.netda.net) last evening. ;-)
I'm going to Microsoft's Professional Developers Conference (PDC) this year!
See you there!
Most .NET developers store a DataSet in a Session variable, then create a DataView from the DataSet's DataTable on Page_Load in order to get a different sort and/or filter.
However, you can store the DataView in a Session variable by itself! And it will still contain data when you pull it out of the Session variable on another page!
' Create and fill a DataTable from Northwind's Customer table
Dim connString As String = "Server=(local);Database=Northwind;UID=sa;PWD=myPassword"
Dim sqlConn As SqlClient.SqlConnection = New SqlClient.SqlConnection(connString)
Dim sqlSelectCmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("Select * From Customers", sqlConn)
Dim sqlDataAdapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter
sqlDataAdapter.SelectCommand = sqlSelectCmd
Dim dataTable As DataTable = New DataTable("Customers")
sqlDataAdapter.Fill(dataTable)
' Create a new DataView from the Customers DataTable
Dim dataView As DataView = dataTable.DefaultView
' Place the DataView into Session var
Session("dataView") = dataView
' Redirect to another web page
Response.Redirect("WebForm2.aspx")
Now you might think (as I did for a while) that the DataView is making a copy of the DataTable into it's Table property (since rows.count was > 0).
Dim dataView As DataView = DirectCast(Session("dataView"), DataView)
Dim rowCount As Integer = dataView.Table.Rows.Count
However, that is not the case (thanks to Thomas Tomiczek who noticed the correct behavior)! What happens is that the DataView still has a reference to the DataTable. And hence that DataTable stays in memory until the DataView releases the reference. Then the DataTable will be removed when GC occurs.
Saving a DataView in session is pretty cool (most folks don't know that you can do this). But the key point here is that the DataView does NOT make a copy of the data. It still is using the referenced DataTable underneath the covers...
More Posts