Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27039

How do i deal with large IF Statments causing program to hang

$
0
0
Hi,

I'm looking for some advice on how to make my program work better.

The issue I have is that I have around 800 IF statements behind a command button so when the command button is pressed for the first time it causes the program to hang for around 10 seconds. After that It works fine once pressed.

The program is a search tool bar, almost an internal directory so loads of different variations.

Program works perfectly fine, just need help on some how getting this to load before the program? or better way or doing it?

New to this so any help would be appreciated.

Here is a very basic example of the code i'm using. Basically this 800 times with changes to the combobox text and websites.

Code:

    Private Sub cmdSerach0_Click(sender As Object, e As EventArgs) Handles cmdSearch0.Click
        If ComboBox1.Text = "Web Search" And ComboBox2.Text = "Google" And ComboBox3.Text = "" And ComboBox4.Text = "" Then
            Dim myprocess As New Process()
            Dim searchstring As String = _
            System.Web.HttpUtility.UrlEncode(txtSearch0.Text)
            Dim urlstring As String = "http://www.google.co.uk/search?q=" + searchstring + "&source=lnms&tbm=isch&sa=X&ei=cwAiUoqwG4Pb7AbzjIGQAg&ved=0CAcQ_AUoAQ&biw=1301&bih=612"
            myprocess.StartInfo.FileName = urlstring
            myprocess.Start()
        Else
        End If


Viewing all articles
Browse latest Browse all 27039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>