Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open multiple urls from richtextbox

Tags:

c#

I have this code to open multiple urls from a richtextbox, it works fine, but the problem is that it opens all sites in separate browsers.

 private void button1_Click(object sender, EventArgs e)
 {
     for(int i = 0 ; i < richTextBox1.Lines.Length ; i++ )
     {
        Process.Start("http://" + richTextBox1.Lines[i]);
     }
 }

Any ideas how I can open the pages like tabs in the same browser?

like image 396
mohammed kraizim Avatar asked Dec 16 '14 19:12

mohammed kraizim


Video Answer


1 Answers

This worked for me...

private void button1_Click(object sender, EventArgs e)
{
    foreach (string item in richTextBox1.Lines)
    {
        if (!string.IsNullOrEmpty(item))
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.FileName = "firefox.exe";
            startInfo.Arguments = "-new-tab " + item;
            Process.Start(startInfo); 
        }
    }
}
like image 191
JimDel Avatar answered Sep 28 '22 05:09

JimDel