CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010
    Posts
    6

    C# get info then open a webpage based on that info on click but opens it twice why?

    i have this piece of code which works great except it searches Google twice in 2 tabs sometimes 2 windows.. whys that? and how can i fix it?

    {
    ManagementObjectSearcher Vquery = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
    ManagementObjectCollection Vcoll = Vquery.Get();
    foreach (ManagementObject mo in Vcoll)
    {
    System.Diagnostics.Process.Start("http://www.google.com/search?hl=en&q=" + mo["name"].ToString());
    }

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: C# get info then open a webpage based on that info on click but opens it twice wh

    Well it is in a loop. You need to exit the loop / set the boolean value of a variable to true / false

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: C# get info then open a webpage based on that info on click but opens it twice wh

    You may also find that in each of the 2 tabs / windows, google searches for a different video controller - which may actually be a good idea

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured