Jump to content

Search Tool Tutorial

- - - - -

  • Please log in to reply
14 replies to this topic

#1
Genny

Genny

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 203 posts
This is a tutorial for people who want the easy way to things like me. ^^
You will need:

- 3 CheckBox's Named Google, YouTube and Yahoo
- 2 RadioButtons Named Image and Web
- 1 Button Named SearchButton
- Textures :D (Optional)

Posted Image

1. Make the Google Button, Checked by Default and the Web Search Selected.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Google.Checked = True
        Web.Checked = True
    End Sub
2. The following codes dissables the Image and Web Button options got Google if Google isn't checked.

Private Sub Google_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Google.CheckedChanged
        If Web.Checked = True And Google.Checked = False Then
            Web.Enabled = False
        ElseIf Web.Checked = False And Google.Checked = False Then
            Web.Enabled = False
        ElseIf Google.Checked = True Then
        End If
        
        If Image.Checked = True And Google.Checked = False Then
            Image.Enabled = False
        ElseIf Image.Checked = False And Google.Checked = False Then
            Image.Enabled = False
        ElseIf Google.Checked = True Then
            Image.Enabled = True
            Yahoo.Checked = False
            YouTube.Checked = False
        End If

    End Sub
3. For the Search Button the code is as follow's. "On Error Resume Next" one of the problems I found with the code I used, is that everytime you Search for something, it opens and works proply. But then you get an error with the code. To fix that I added "On Error Resume Next"

 Private Sub SearchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchButton.Click
        If YouTube.Checked = True Then
            On Error Resume Next
            System.Diagnostics.Process.Start("http://youtube.com/results?search_query=" + SearchBox.Text)
                    ElseIf Yahoo.Checked = True Then
            On Error Resume Next
            System.Diagnostics.Process.Start("http://search.yahoo.com/search?p=" + SearchBox.Text)
        End If

        If Google.Checked = True And Web.Checked = True Then
            On Error Resume Next
            System.Diagnostics.Process.Start("http://www.google.com/search?hl=en&q=" + SearchBox.Text)
        ElseIf Google.Checked = True And Image.Checked = True Then
            On Error Resume Next
            System.Diagnostics.Process.Start("http://images.google.ca/images?hl=en&q=" + SearchBox.Text)
        End If
    End Sub
4. Finally, the Google, YouTube and Yahoo Check Buttons Code. This only one search method is checked at a time. If this code isn't added and you click search, you will Open 2 or 3 Different Browsers searching the same thing. Hehe.
 Private Sub Yahoo_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Yahoo.CheckedChanged
        If Yahoo.Checked = True Then
            Google.Checked = False
            YouTube.Checked = False
        End If
    End Sub

    Private Sub YouTube_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles YouTube.CheckedChanged
        If YouTube.Checked = True Then
            Yahoo.Checked = False
            Google.Checked = False
        End If
    End Sub
    Private Sub Google_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Google.CheckedChanged
        If Google.Checked = True Then
            Image.Enabled = True
            Web.Enabled = True
            YouTube.Checked = False
            Yahoo.Checked = False
        End If
    End Sub
5. If you had any textures, this is the time to add them. Enjoy :D

Edited by Jordan, 25 July 2008 - 06:01 AM.


#2
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Good and simple tutorial.

This is VB 6.0 right?

#3
Genny

Genny

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 203 posts
Nope, this is VB 9.0 (2008 Express Ed)

#4
Genny

Genny

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 203 posts
What Language to you use TcM?

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Well, depends. I used to program in VB, but stopped. I'm learning C#, and PHP. But I know other languages, that are not so famous though...

#6
Genny

Genny

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 203 posts
I see. Well I've always done VB, i did 6.0 etc... now im at vb 9.0. But I know Logo programming. And I know some basic Java programming. Basic C++. But never asmuch as VB.

#7
kerex

kerex

    Newbie

  • Members
  • Pip
  • 1 posts
thanks for the tutorial ..

#8
mendim.

mendim.

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,393 posts
Great Tutorial +rep

#9
shoaibbi

shoaibbi

    Newbie

  • Members
  • PipPip
  • 15 posts
BRILLIANT
VIvAcIoUs pAkIsTaNi

#10
Egz0N

Egz0N

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,034 posts
cool tutorial .. +rep :)

#11
ravmonster

ravmonster

    Newbie

  • Members
  • PipPip
  • 18 posts
i love your idea...

#12
Zizooooo

Zizooooo

    Newbie

  • Members
  • PipPip
  • 15 posts
simple but so effective
nice shot,
go on ,,,,




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users