Finding what you need in the Microsoft® Visual Studio® .NET documentation, which has over 45,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
Dear Doc Detective,
I have a dataset with multiple tables and a relationship in it. Something like:
Table(0)
--CustomerID
--CustomerName
--CustomerAddress
Table(1)
--OrderID
--CustomerID
--OrderDate
All customers and their associated order records are in these tables, and I pass a string that could look like any of the following:
"CustomerName = 'Fred'"
OrderDate > '1/2/2002'"
"CustomerName = 'Bob' AND OrderDate = '1/1/2002'"
With the first and second example, it's no problem because I can direct the filter at a single view within the manager. In the case of the last example, how can I apply that filter to the DataViewManager as a whole?
- Out of sorts in Orlando
Dear Out,
There is no Help topic that addresses this specifically since you can't apply a filter to the DataViewManager as a whole. Each DataView can only hook to one table.
Basically, there's no "one-stop shopping" object to return this type of query from the dataset?to accomplish a filtered view across tables you need to query each table.
"CustomerName = 'Bob' AND OrderDate = '1/1/2002'"
You need to first figure out the CustomerID for 'Bob' from Table(0), and then query Table(1) for all records where 'CustomerID = (Bob's ID from Table(0)) ' and OrderDate='1/1/2002'
To learn more about filtering and sorting, look for the topic "Introduction to Filtering and Sorting in Datasets" in the MSDN Library?there's a lot of good information there that you can sort through.
- Doc D
Dear Doc Detective,
I have a directory of Word docs (maybe two or three hundred) based on a custom template. They each have 20 or so fields. I would like to read all of the fields into a database. Specifically I'm looking for a 'field' object. There is also a bunch of info in the Word docs that I don't want. (I just need the fields.)
I have looked through the library (MSDN) and posted this to the dotnet.language.vb newsgroup. Hopefully I missed the reference I'm looking for or you can provide some assistance. Any help would be appreciated.
- Field Tested in Fresno
Dear Field,
Admittedly our documentation doesn't cover how to use the Word object model in great detail; however, you can find information on the Field object itself in the Word Object Model (VBA) documentation. Interestingly enough, I couldn't find the topic using MSDN's search mechanism, but I did find it in the Table of Contents. The topic name is "Field Object" and it's under "Office Solutions Development | Microsoft Office | Microsoft Office XP | VBA Language Reference | Microsoft Word Visual Basic Reference | Objects."
I'm not sure exactly how your documents are structured, but if the fields are always in the same position, you should be able to use the index to retrieve only the field that you want. If not, you may have to walk through the Fields collection and discard the ones you don't need. Follow the doctor's advice and you'll be outstanding in your field.
- Doctor D
Dear Doc Detective,
I'm writing an MDI application where I need to prevent the user from closing one of the MDI child windows. I tried adding code in the Closing event for the child form, but that also prevents the form from closing when the parent form is closed.
In Visual Basic 6 I could use the QueryUnload event to determine the reason that the form was closing and cancel if it was the child. How do I do the same thing in Visual Basic .NET?
- Closed for Business in Cleveland
Dear Closed,
I'm afraid the docs aren't much help on this one. The topic "Form Object Changes in Visual Basic .NET" contains mappings for all of the properties, methods, and events. For the QueryUnload event, it says simply "There is no replacement for UnloadMode."
This isn't exactly true?the simplest way to do this is to override the WndProc and set a flag before Closing is called on the child form. The following code example illustrates this:
' In the parent form.
Public Shared allowclose As Boolean = False
Dim WM_CLOSE As Integer = &H10
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If (m.Msg = WM_CLOSE) Then
Me.allowclose = True
End If
MyBase.WndProc(m)
End Sub
' In the child form.
Private Sub Form2_Closing( _
ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
If Not Form1.allowclose Then
e.Cancel = True
End If
End Sub
Until Visual Basic reintroduces an UnloadMode, this should get you back in business.
- the Doc
Doc's Doc Tip of the Day
This month, the Doc has a bunch of tips for using the Index to quickly find the right topic.
Use filters with the Index window to weed out index entries that don't apply to you. For example, at the top of the Index window, in the Filtered by list, select "Visual Basic."
If you do not find the entries you expect, try reversing the words you enter. For example, if "debugging inline assembly code" did not display any relevant entries, try typing, "assembly code, debugging inline."
Scroll up and down the index entries. Not all topics are indexed the same way, and the one that could most help you might be higher or lower in the list than you expected.
Enter words as singular or partial string without endings. By entering a partial string, you can get to topics that have been indexed with search keywords that are singular or plural. For example, enter "propert" to start your search above properties and property.
Try entering gerund (-ing) forms of the verb for the task you want to complete. To find more specific index entries, append a word that describes exactly what you want. For example, type "running" to get more entries or "running programs" to get fewer.
Try entering standalone adjectives. To narrow the results, append a word that describes exactly what you want. For example, enter "COM+" to get a wide range of entries or "COM+ components" to get fewer.
Omit indefinite articles (such as "a") because the Index window ignores them.
Found a topic in Help that doesn't help? Tell the Visual Studio documentation team about it at vsdocs@microsoft.com.
URLs
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbawd10/html/woobjField.asp