Ask the Doc Detective: Delegates and Events Problem, Writing Faster VB.NET Apps, and More

an’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 [email protected].

Dear Doc Detective,

I’m doing a chat application based on the “Delegates and Events” sample provided in the .NET Framework SDK documentation. My application fires an event each time a message arrives on the socket. When I’m doing a Form.Show or trying to make an icon visible, my form is not responding. Any idea what the cause might be?

– Chatty in Chattanooga

Dear Chatty,

There is actually a known problem (notice I didn’t say “bug”) with the sample?the sample works as written only if the client, remotable object, and remoting host assemblies reside in the same directory.

There is a Knowledge Base article (Q312114) that describes this problem and provides code to fix the problem. Check it out and you’ll be chatting away in no time at all.

– Doc D


Dear Doc Detective,

How do I write faster Visual Basic .NET applications? What resources are available on MSDN (or elsewhere) to find “recipes” or tips on how to write VB .NET code that the compiler can optimize very well?

– Poky in the Poconos

Dear Poky,

Of course, we all know that Visual Basic .NET helps you write applications faster, but writing faster applications is another thing altogether. Actually, there are a number of resources in the MSDN Library that can be of help.

The article “Performance Optimization in Visual Basic .NET” provides some great tips on creating faster applications. If you want to delve deeper, look for “Writing Faster Managed Code: Know What Things Cost,” and for best practices, read “Improving .NET Application Performance and Scalability“?especially Chapter 5 on “Improving Managed Code Performance.”

– Doctor D


Dear Doc Detective,

I’m trying to build a multi-threading operation that queries a Web site. It fetches 100 pages and then searches for a common text string. What I want to know is, what is the best way to fire off multiple threads to attack 10-20 page loads at once?

– Perplexed in Portland

Dear Perplexed,

When it comes to multi-threading there is no single answer as to what’s “best”?it depends on hardware, bandwidth, and many other factors. What I would do is take a look at the article “Crawl Web Sites and Catalog Info to Any Data Store with ADO.NET and Visual Basic .NET” and use that to get started.

– the Doc


Dear Doc Detective,

I have an application built in Visual Studio .Net 2003. This application has an ASP.NET project, two windows services applications, and one MSDE database. This MSDE database needs to contain some data, not just table structure. How can I do this in the deployment?

– Data Driven in Dayton

Dear Driven,

You should be able to do this using a Web Setup Project and a custom action to create and populate the database. The topic “Walkthrough: Using a Custom Action to Create a Database During Installation” describes how to create a database and add a table?you could take it from there and add code or a script to loop through and populate the database.

– Doc Detective


Dear Doc Detective,

Currently I am working as a Java programmer in a company, our company is starting to work more in Visual Basic .NET. Can I directly study Visual Basic .NET without having Visual Basic 6 knowledge?

– Jittery in Jacksonville

Dear Jittery,

You can indeed?due to the differences between Visual Basic 6 and Visual Basic .NET, starting with a blank slate may actually give you an advantage. The fact that you already know Java should help as well.

A good place to start is the Visual Basic Developer Center on MSDN?and congratulations on kicking the caffeine habit!

– Doc D


Doc’s Doc Tip(s) of the Day
A reader recently wrote the following about a previous tip:

“In your Ask the Doc Detective column of the 2004?July/August issue, you stated: ‘If you find a topic using the Index or Search windows, don’t forget to use the Sync Contents button (the double-ended arrow) to see where you are in the table of contents.’ When some topics are displayed, however, the Sync Contents button is disabled. Do you know why, and how to enable it?”

I’ve seen this behavior on occasion myself, so I did a little testing to see if I could reproduce it. It turns out that this happens when you have a filter set and you reach a topic either via F1 or via a link in another topic. If the topic isn’t part of the current filter set, it isn’t in the current table of contents, so there is nothing to synch to.

Found a topic in Help that doesn’t help? Tell the Visual Studio documentation team about it at [email protected].

URLs:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpsamples/html/delegates_and_events_technology_sample.asp

http://support.microsoft.com/?kbid=830502

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchPerfOpt.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/fastmanagedcode.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenetchapt05.asp

http://msdn.microsoft.com/msdnmag/issues/02/10/SpiderinNET/default.aspx

http://msdn.microsoft.com/library/?url=/library/en-us/vsintro7/html/vxwlkWalkthroughUsingCustomActionToCreateDatabaseDuringInstallation.asp?frame=true

http://msdn.microsoft.com/vbasic/

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet