Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to refresh a URI in an InternetExplorer tab if it matches another URI.
The issue is that it will not refresh the URI of the IE tab.

So basically, if IE is open, search the URI of each tab and if that URI matches a particular URI then just update it with the new URI and go to that page.

Purpose of this code is code to see if IE is open, if not open IE with the correct URI.

If IE is open then check to see if one of the tabs is already pointed to a CRM page. If pointed to CRM page then just refresh the page with the new data. If IE open but no tab pointed to the CRM page then open new tab.

I have the code working for New IE and New IE Tab.
I just can't the refresh with new URI on Existing CRM page.

C#
ShellWindows sw = new ShellWindows();
        for (int i = 0; i < sw.Count; i++)
        {
            ie = (InternetExplorer)sw.Item(i);

            //Check for Objects
            if (ie != null)
            {
                //get url of IE instance
                string url = ie.LocationURL;
                if (url.Length >= 30)
                {
                    string urlSubstring = url.Substring(0, 30);
                    string static_urlSubstring = static_url.Substring(0, 30);
                    if (urlSubstring == static_urlSubstring)
                    {
                        cppExists = true;
                        string newURL = static_url + "customerNumber=" + CustTextBox.Text;
                        object m = String.Empty;
                        object urlObject = newURL;
                        ie.Visible = true;
                        ie.FullScreen = false;
                        ie.Navigate2(ref urlObject, ref m, ref m, ref m, ref m);
                        Console.WriteLine("After Navigate" + urlObject);
                        break;
                    }
                    else
                    {
                        custExists = false;
                    }

                }

                // Now See if Object is a browser

            }
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900