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

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:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as