an't find what you're looking for? Just askif 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 firstname.lastname@example.org
Dear Doc Detective,
I'm designing an application that will run primarily in the background without user intervention. I want to put a little icon on the taskbar that the user can double-click to open a configuration dialog boxsomething similar to the Windows® Update icon. I've searched the index under "icons" and "taskbar," but I can't seem to find anything telling me how to do this.
Stumped in Stamford
It's just a matter of terminologyyou are supposed to know that the taskbar has a "notification area" and the icon is called a "notification icon." From there you should just naturally understand that what you need is a NotifyIcon component. Never mind that it's indexed under "system tray," which is the unofficial name for the notification area. Clear as mud, right?
The topic "Adding Application Icons to the Taskbar with the Windows Forms NotifyIcon Component" should get you started.
The one thing that the topic doesn't discuss is how to get rid of the icon once your dialog closes. You will need to set the NotifyIcon component's Visible property to false in the form's Closing event, otherwise the icon will remain in the system tray.
Now, as for the icon itselfI would gladly supply you with a picture of the good Doc that you could use....
Dear Doc Detective,
I've created an ASP.NET server control by following the steps in the walkthrough on creating a custom Web control. It works just fine, but now I'm ready to share my control with my coworkers. I want to allow them to set properties for the control in the Properties window at design time. How do I do this?
Propertyless in Providence
Real programmers set properties in code, not in the Properties window. That said, adding Property window support for your ASP.NET server control is easyit just isn't covered very well in the documentation.
There is, however, a recent article on MSDN (msdn.microsoft.com/library) that covers this as well as other related subjects such as adding IntelliSense® support for your control. Just search the library for "Adding Design-Time Support to ASP.NET Controls."
For those that are looking for an introduction to ASP.NET server controls, the aforementioned walkthrough is a good starting point. Just look for the topic "Walkthrough: Creating a Web Custom Control."
Dear Doc Detective,
I'm in the process of upgrading a VB 6 application to VB.NET. During the upgrade, my drag and drop code wasn't upgraded, but I found a topic that showed me how to implement drag and drop in VB .NET. The problem is, my old application supported dragging multiple items from one ListBox to another. When I try this in VB.NET, the MouseDown event invalidates the multiple selection. I could do this in VB 6 , so why doesn't it work in VB .NET?
Clueless in Cleveland
That's a real drag! Admittedly, once you get beyond the basics of drag and drop, the Visual Basic documentation isn't much help. What the docs don't tell you is that you should use a ListView
control instead of a ListBox
. The ListView
control has an ItemDrag
event, which can be used instead of the MouseDown
event, allowing you to drag multiselected items.
There is a recent article on MSDN that demonstrates dragging and dropping between ListView controls, as well as several other advanced drag and drop techniques. Just look for "Implementing Drag and Drop in Visual Basic .NET," and soon you'll be dragging 'til you drop.
Doc's Doc Tip of the Day
In Visual Studio .NET, when you press F1 to get Help, the Help topic shows up in the IDE in a docked window. To make it easier to read Help while working, you can undock the window in various ways. One is to right-click the tab for the Help topic and then choose Floating. You might also find it useful to open Help as a separate application. From the Start menu, choose Programs, Microsoft Visual Studio .Net, Microsoft Visual Studio .Net Documentation. (Make yourself a shortcut if you do this often.) That way, you can use ALT+TAB to switch between the IDE and Help.
Do you avoid Dynamic Help because you don't like what it shows? No problemyou can customize it. From the Tools menu, choose Options. Expand the Environment folder and then click Dynamic Help. There you can select the number and types of topics that appear. If you need information on your choices there ... click Help!
Found a topic in the docs that doesn't answer your question? Tell the Visual Studio documentation team about it at email@example.com.