Document Outline for Windows forms

Many of you may be familiar with the Document Outline feature in word. Did you know Visual Studio also has a Document Outline. It's there in VS 2003 for Web Forms, in 2005 MS has made it useful to windows developers also.

To open the Document Outline window goto View | Other Windows | Document Outline or Ctrl-Alt-T.

Some things you can do with the Document Outline Window.

  • See a list of all your controls
    • This is not just a list though, it's a nested view of your form via treeview. Showing what container each control is in. This is a useful way to view a complex form. Any windows developer will tell you sometimes a form gets complicated and it's difficult to get a good picture of what is going on with splitters, panels, tabs etc.

  • Select controls to change their properties
    • We have all done it; clicked on a control on a form and inadvertantly moved it. With the Document Outline you can select a control so that you can use the property explorer without actually touching the form. You can also do this in the property browser itself using the list box at the top but it's easier to select the control from the Document Outline Window, because you can see all of them at once. If anyone from MS is reading this I would like to be able to multi select controls from this window.
  • Move controls from one container to another
    • One very cool feature is being able to move control from one container to another using the Document Outline. for example; you can drag a control from one side of your Split Container to the other or from a panel to the form, right in the Document Outline window. This can be very useful on a complicated form with many controls.

I'm not sure how much I will use this window once developing on a regular basis with it. But I can think of a few projects it would have come in handy.

Snap Lines

I know snap lines are not a big deal especially when you look at all the other new features of Visual Studio 2005. But for a windows developer they are a welcome productivity tool.

I'm not blogging to tell you 2005 will have snap lines. I'm blogging to show you this cool feature of snap lines.

Lets take a label and a textbox for example, this is likely where they will come in the most useful. Being able to visually line these two controls up is a real time saver.

Did you know you can also line up the text in the label with the text in the textbox.

Now that is nice.

Removing unwanted space in a report

There is a little trick in Reporting services that is not easy to find.

I created a report for a client that included an external class which parsed a stream of XML and returned various data from the XML for display in the report. The nature of the data was that not everything is required for each row. For example, each XML document would contain a question and answer given by the end user. Some questions would contain a tip to help the user and others did not.

To make the report generic, I used a table with multiple details bands for each question. Each textbox in the table would go after a different piece on data in the XML. The output of the report looks something like this:

Q: Should golf be 18 holes?
A: No.

Q: How many holes should a round of golf be?
A: 12.
Tip: The answer is 12.

Q: Why 12?
A: It just makes sense.

As you can see, some rows contain a tip and some do not. When the report calls the parser it gets back a “NoData” message indicating that there is no tip for this question. The problem you will find is there will be a space where the empty tip textbox is. (see example)

----------------------------------------------------------------------------------------

Q: Should golf be 18 holes?
A: No.
   [extra space not required]

Q: How many holes should a round of golf be?
A: 12.
Tip: The answer is 12.

Q: Why 12?
A: It just makes sense.
   [extra space not required]

----------------------------------------------------------------------------------------

You might have tried the following.
Put an expression on the textbox's hidden property so that if the NoData message is returned the textbox is made invisible like this:

=iif(Me.Value = "NoData", true, false)

You will find the extra space is still there.

You may have tried to set the text box property CanShrink to True, but the space will still be there.

Here is the trick. Make the height of the textbox zero. Reporting Services will change that to some default like .03 but this is the only way to remove the space. Make sure you set Can Shrink and Can Grow to True.

Duplicated Parameters in SRS Dataset

It's time I logged this hear so I can remember what the problem is when I get it. :)

When using a Stored Procedure in a Dataset in Reporting Services, Have you ever seen double the parameters on the refresh dialog in the Data Tab? They are actually listed twice in the dialog like this.

OrderId
OrderItemId
ProductID
OrderId
OrderItemId
ProductID

This is caused by duplicate versions of the Stored Procedure. For example

dlloyd.apGetOrder
dbo.apGetOrder

If you remove one of the Stored Procedures the parameters will return to normal.

GEOCaching

Now this is fun for the whole family.

I bought a GPS mostly because it came with Streets and Trips for $140 at Costco. Seemed like a good deal. We used it on a drive to Pittsburg to a friends 40th.

Then Barry tells be about GeoCaching. So I check out GeoCaching.com . We went yesterday.

It was so much fun. If you have a GPS and you havn't tried this I urge you to give it a go.

 

ObjectSharp Sponsors BitNet

ObjectSharp recently became a proud sponsor of BitNet.

BitNet is an association of individuals, businesses and organizations with a common interest in the practical and innovative use and development of technology, to the benefit and prosperity of the Golden Horseshoe community.

We look forward to a rewarding relationship with BitNet and it's members.

Reporting Services Special Directories

Where to put a report so that it shows up in the New Item Dialog as a template:

  •   C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\ProjectItems\ReportProject

Where to put a custom class so it can be found by Report Server

  • C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin

Where to put a custom class so that it can be found by the designer

  • C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer

Google Intellisense

I'm looking for a practical application for this.

Barry pointed out to me that Google has a beta site with Intellisense. Now I appreciate google and it's research as much as the next guy. And I love that they create these things. But I am curious what practicle applications people can think of for this.

So please tell me how Intellisense is useful on a Web Search engine. I'll start things off.

Perhaps I don't know what I'm looking for. Maybe I want to know what pubs are in Boston, will I be able to enter “Boston pubs” and it will fill in the rest like they were memebers in a class.

Other ideas welcome.

Parameter Collection MultiValue not implemented yet

The Parameter collection in Reporting Sevrices has a boolean property called MultiValue. I wanted to use this so we could tell the front end that the user should be able to return multiple values for this parameter. There is no where to set this value in the Report designer. So I added it to the RDL manually. But it always comes back false.

After searching the MS Reporting Service News Group  I found out this is not implemented yet. It is defined in the parameter class but not used. Even the help references it. MultiValue - Indicates whether the parameter can be a multi-value parameter. Boolean

Here is the response from MS in the news group:

The MultiValue element is part of the RDL specification published in 2003/10. It was not implemented in V1 of Reporting Services. It will be available in the next version. The MultiValue boolean flag determines if a report parameter is a multi value parameter.

Reporting Services - Report Parameter - Available Values

I would like to interrupt my discussion of how to create an inbox at this time to point out a potentially annoying feature/defect in the ValidValues collection in Reporting Services.

When you add parameters to the report you can add a list of Valid Values. I think it's called Available Values in the UI. This would typically be a list of codes and display values used in a drop down list. The entries can be queried or hard coded right in the report.

Since we are building a front end to RS and passing the parameters to JSP for rendering on a web page we have to try a few different things, to make sure we can generically render the controls for gathering parameters on the web site.

So I created a test report which retrieved the customers from Northwind. The customer code is a string. So to keep it simple I made that a parameter and I put three of the customer codes into the Valid Values section of the report Parameter. Both the Label and Value were the same. I know this seems a bit odd, but I have seen real applications where this is the case. In some industries the code is known by the end user. For example they don't care that YYZ is the code for Toronto airport. They know YYZ is and that is what they want to see in a selection list. (calm down it's just an example)

Anyway back to the problem. If you create a parameter of the type string and fill in the Valid Value list with the same data in the label and the value, you will notice that when you call GetReportparameters to populate the parameter collection the valid value labels will be null. Perhaps someone thought if the value and label are the same they don't need the label. Although this might be true why make us write special code to know that and ignore the label. Just pass through the label as is even if it is the same as the value.

I hope it's just a bug and not a design decision. By the way I installed Service Pack 1 and it's still the same.