Solved

Order code executes

Posted on 2013-10-30
4
420 Views
Last Modified: 2013-11-08
Hi guys,

I have the following on 2 different button clicks:

Button1:

WebBrowser_Sourcing_BrokerForum_Enquiry.Navigate(new Uri(" http://www.brokerforum.com/iris-parts-search.authenticated-en.jsa"));

Open in new window


Button2:

 try
            {


                var htmlDoc1 = (HTMLDocument)WebBrowser_Sourcing_BrokerForum_Enquiry.Document;


                var UsernameTextBox = (mshtml.HTMLInputElement)htmlDoc1.all.item("Session_Username", 0);
                UsernameTextBox.value = "XXXX";

                var PasswordTextBox = (mshtml.HTMLInputElement)htmlDoc1.all.item("Session_Password", 0);
                PasswordTextBox.value = "XXXX";



                foreach (mshtml.HTMLInputElement HTMLI in ((mshtml.HTMLDocument)WebBrowser_Sourcing_BrokerForum_Enquiry.Document).getElementsByTagName("input"))
                {

                    if (HTMLI.getAttribute("type").Equals("image"))
                    {
                        if (HTMLI.src == "http://www.brokerforum.com/tbf/img/login-button-en.png")
                        {

                            HTMLI.click();
                            return;
                        }
                    }


                }
            }

            catch (Exception) { }

Open in new window


This all works fine. But when I combine the 2 into a 'loaded' grid event the login never occurs. Why do they work separately on buttons but not when combined? Is it the order the code is executing?

Thanks,
Dean
0
Comment
Question by:deanlee17
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Ess Kay
ID: 39611820
have you tried debugging it?

Set up a breakpoint, and see if they even get called in the first place
0
 

Author Comment

by:deanlee17
ID: 39611865
It does indeed.
0
 
LVL 15

Accepted Solution

by:
Ess Kay earned 500 total points
ID: 39612155
ah... perhaps the problem is the scope.

you need to use the keyword this.
everywhere

or this.parent.
 ...not sure which one but one of them will work

because it is looking for those objects withing the datagrid, not within the form.
You need to access the parent of the grid

ie:

this.WebBrowser_Sourcing_BrokerForum_Enquiry.Navigate(new Uri(" http://www.brokerforum.com/iris-parts-search.authenticated-en.jsa"));

or

this.parent.WebBrowser_Sourcing_BrokerForum_Enquiry.Navigate(new Uri(" http://www.brokerforum.com/iris-parts-search.authenticated-en.jsa"));
0
 

Author Comment

by:deanlee17
ID: 39613609
Nice idea, but it doesn't change anything.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question