none
{ComboBox} Search Navigation Option WebBrowser RRS feed

  • Question

  • Hey Guys,
    I am in the middle of making an advanced webbrowser and am stuck on one issue. I found a code on the internet which allows me to put images in a combobox via an imagelist. I have 3 Images 1 for google, 1 for Yahoo and 1 for Youtube. I have come up with a basic code but dont know how to set it so that when i have selected lets say yahoo(image) and type in the search textbox and clik search it will navigate to the images "website"
    Image 1 is google
    image 2 is youtube
    image 3 is yahoo

    I named the images
    [0] Image1
    [1] Image2
    [2] Image3

    Heres the code I have:

    Public Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
    If "This should be the selected image in the combobox(google)" Then
    CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("http://www.google.com/search?hl=en&q=" & TextBox1.Text & "&btnG=Google+Search&meta="}
    End If
    If "This should be the selected image in the combobox(youtube)" Then
    CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("http://www.youtube.com/results?search_query=" & TextBox1.Text & "&search_type=&aq=-1&oq=")
    End If
    If "This should be the selected image in the combobox(yahoo)" Then
    CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("http://au.search.yahoo.com/search?p=" & TextBox1.Text & "&ei=UTF-8&fr=moz35")
    End If
    End Sub

    If you need anymore code of the combobox images please ask

    Thanks
    Wednesday, September 22, 2010 4:21 AM

All replies

  • Heres the code for the combobox

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Me.ComboBox2.Items.AddRange(items)
    Me.ComboBox2.DropDownStyle = ComboBoxStyle.DropDownList
    Me.ComboBox2.DrawMode = DrawMode.OwnerDrawVariable
    Me.ComboBox2.ItemHeight = Me.ImageList1.ImageSize.Height
    Me.ComboBox2.Width = Me.ImageList1.ImageSize.Width + 23
    Me.ComboBox2.MaxDropDownItems = Me.ImageList1.Images.Count
    End Sub


    Private Sub ComboBox2_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ComboBox2.DrawItem

    If e.Index <> -1 Then
    e.Graphics.DrawImage(Me.ImageList1.Images(e.Index) , e.Bounds.Left, e.Bounds.Top)
    End If
    End Sub



    Private Sub ComboBox2_MeasureItem(ByVal sender As Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs) Handles ComboBox2.MeasureItem

    e.ItemHeight = Me.ImageList1.ImageSize.Height
    e.ItemWidth = Me.ImageList1.ImageSize.Width
    End Sub

    Wednesday, September 22, 2010 6:33 AM