Finding what you need in the Microsoft® Visual Studio® 2005 documentation, which has over 200,000 topics, can be a daunting task. The Doc Detective is here to help, utilizing his investigative skills to probe the depths of the documentation.

Can’t find what you’re looking for? Just ask-if it’s in there, I’ll find it for you; if it isn’t, I’ll let you know that as well (and tell you where else you might go to find it).

Have a question for the Doc? Send your questions for future columns to me at docdetec@microsoft.com.

Dear Doc Detective,

I’m developing an application that uses a local SQL Server database, and I’ve run into some odd behavior. I can run the app in Visual Studio and add or change some data, but the next time I run the changes haven’t taken.

If I publish my app and install it on another computer, the last batch of changes that I made show up, and any further changes that I make in the installed version are also preserved. What’s up with that?

- Baffled in Baltimore

Dear Baffled,

You aren’t alone-the local data story in Visual Studio 2005 isn’t very intuitive, but once you understand it, it makes perfect sense. In a nutshell, the behavior of a local database file is controlled by the Copy to Output Directory property.

The default setting is Copy always. What this means is that there are two copies of the database-one in your project directory, and one in the output directory (your project location\bin\Debug). Each time you press F5 the copy in the output directory is overwritten by the one in your project directory.

Changes that you make at design time in the IDE will show up at run time, but changes that you make at run time will be overwritten the next time you run. Once deployed, you are working with a single copy of the database that reflects any changes made the last time it was run before publishing.

If this isn’t the behavior you want, you can change the Copy to Output Directory property. This is discussed in the topic "How to: Manage Local Data Files in Your Project". Just like the burger joint, Visual Studio lets you have it your way.

- Doc D

Dear Doc Detective,

I’m working with the new DataGridView control in Visual Studio 2005. While it is a huge improvement over the old DataGrid control, I have still run into one problem that has me stumped.

Basically I have a bound DataGridView with order information. I have a text box where a user can enter a package ID, and I want to scroll the grid to the row that contains that package ID. I could loop through and check the values of each row in the grid, but with over 100,000 rows I’m afraid the performance would be less than optimal.

I’ve searched for a Find function, but the DataGridView doesn’t seem to have one. Can you help? I really need to find a way to make this work.

--Gridlocked in Greeley

Dear Gridlocked,

You have the right idea, but you are looking in the wrong place. Rather than searching the grid you should be searching the underlying BindingSource-for your example, you could find the package ID with code similar to the following:

Dim packageID As String
    
' Get the value from the package ID text box
packageID = PackageIDTextBox.Text
    
' Use the Find method to find the packageID
' value in the PackageIDColumn column and set
' the Position property to its row
Me.Table1BindingSource.Position =
Me.Table1BindingSource.Find("PackageIDColumn",
packageID)

The beauty of this method is that it not only finds the value in the BindingSource, it also automatically repositions the bound DataGridView and highlights the packageID value.

Unfortunately this isn’t very well documented-the "BindingSource.Find Method" topic doesn’t include a code example. The topic "BindingSource Component Overview" provides some background on how the BindingSource works. So in answer to your question: yes, I can help... and sometimes I actually do!

- Doctor D

Dear Doc Detective,

I have a problem with a MDI application that I’m working on. I have placed an image in a picture box on the MDI parent form, but when I add child forms at run time, they appear hidden behind the picture box.

This obviously isn’t the behavior that I want. How can I make the child forms appear on top?

- Hidden in Hilo

Dear Hidden,

Believe it or not, this is the way it was designed to work. Any controls that you place on a MDI container form will appear in front of the Child forms. In general you shouldn’t put controls on a MDI parent form, but there are cases where it is useful-for example, adding a StatusBar to the bottom of the form.

To display a picture on the MDI parent, use the BackgroundImage property of the form itself instead of using a PictureBox control-the BackgroundImage will appear behind the Child forms. While this isn’t specifically covered in the docs, you can learn more about MDI in the topic "Multiple-Document Interface (MDI) Applications". Now you can come out of hiding.

- the Doc

Dear Doc Detective,

I recently installed the Visual C# Express Edition and chose to install MSDN Help as well. As I am attempting to learn C#, I frequently look in the Index to find information. Clicking on some of the entries in the Index brings up an "Information not found" page-surely Microsoft didn’t ship this with so many broken links?

- Linkless in Lincoln

Dear Linkless,

This is an unfortunate limitation of the Express editions. The version of the MSDN Library that you downloaded is the MSDN Library for Visual Studio 2005 Express Editions, which is an abridged version of the full MSDN Library.

This was necessary in order to fit both the library and the Express product on a single CD; every effort was made to ensure that the topics most relevant to the Express editions were included. The side-effect is that links to topics that weren’t included are broken due to a technical issue with the Help engine-you can’t link to a topic that isn’t in the Table of Contents.

The workaround is to use the Search capabilities in Help to find the topic in the online library. This isn’t specifically documented for the Visual C# Express, but is covered in the topic "Troubleshooting Visual Basic Express", which applies to C# as well.

- Doc D

Doc’s Doc Tip of the Day

To be online, or not to be online-that is the question. The Help system in Visual Studio 2005 allows you to integrate online Help with the locally installed documentation, essentially doubling your chances of finding what you need. As existing topics are updated or new topics added, they will be made available online first, so you should really consider taking advantage of this feature.

When you first access Help after installing Visual Studio 2005, you are presented with a dialog box asking you to choose a Help access method. You can choose to look online first and then look locally, look locally then online, or only use local Help. You can change this option at any time in the Tools, Options dialog box under "When loading Help content".

Found a topic in Help that doesn’t help? Tell the Visual Studio documentation team about it at vsdocs@microsoft.com.

URLs

http://msdn2.microsoft.com/en-us/library/ms246989.aspx

http://msdn2.microsoft.com/en-us/library/system.windows.forms.bindingsource.find.aspx

http://msdn2.microsoft.com/en-us/library/xxxf124e.aspx

http://msdn2.microsoft.com/en-us/library/xyhh2e7e(en-US,VS.80).aspx

http://msdn2.microsoft.com/en-us/library/ms172574(en-US,VS.80).aspx