Dear Friend,

on my work i want to use combo box,and in that combo box i have 10 url's,but i cant specify for each..


my code is::

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("www.google.com");

            System.Diagnostics.Process.Start("www.yahoo.com");

            System.Diagnostics.Process.Start("www.bing.com");
        }
    }
}

what my problem is i want to open it in firefox but it is opening in iexplorer and also is there any way to run it in that form itself that is form1

kvprajapati commented: Please use [code] tags. -2

Recommended Answers

All 6 Replies

Just use

System.Diagnostics.Process.Start(comboBox1.Text);

That is if you add the full URL in the combobox

3 windows are opening then what is the problem..

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(comboBox1.Text);
}

This will open a window every time you change something on the combobox

ok thank you actually one more that i want to specify which browser i want to open this like iexplorer,firefox,opera.klemon

That is a bit more complicated you need to launch the browser then send it the url

Process.Start("IExplore.exe",comboBox1.Text);

Change the "IExplore.exe" to the path of the web browser you want to use

thanks i have solved this problem..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.