I'm using vb.net and the web browser control on a win form application where I have a dynamically created 'parent' html page that contains an 'iframe' that points to another dynamically created html page. Get it? Now, the exact reason why I'm doing this isn't the issue, but I'm trying to access the actual html code that resides within the child (iframe) page programatically through vb.net and the web browser control properties/methods (or whatever else...).
Here's what's going on with the code below:
The parent page gets 'navigated' to within the browser control that's sitting on my win form. The iframe gets loaded as well, and immediately begins the submission of the form data (currently 12 times, with an interval of 250ms). As each submission occurs, the parent gets updated through javascript with the current iteration number. When complete, the response to the form posting will present info within the iframe element. I need the actual HTML of the iframe element at this time but I'm not sure how to reference the child objects (elements?) within the web browser control. Can you help? Please include some examples if you're able. Thanks for the help!
Here's the Parent page:
Here's the Child code:
Here's what's going on with the code below:
The parent page gets 'navigated' to within the browser control that's sitting on my win form. The iframe gets loaded as well, and immediately begins the submission of the form data (currently 12 times, with an interval of 250ms). As each submission occurs, the parent gets updated through javascript with the current iteration number. When complete, the response to the form posting will present info within the iframe element. I need the actual HTML of the iframe element at this time but I'm not sure how to reference the child objects (elements?) within the web browser control. Can you help? Please include some examples if you're able. Thanks for the help!
Here's the Parent page:
VB.NET:
<HTML>
<BODY>
<form id="formsubmit">
<input type="text" id="postCounter" value="0";>
<iframe name="iFrame1" src="childpage.html" width="50%" align="left">
</form>
</iframe>
</BODY>
</HTML>
Here's the Child code:
VB.NET:
<HTML>
<head>
<SCRIPT type="text/javascript">
var t=0;
var i=0;
function load()
{
t = setInterval("submitme()",250);
}
function submitme()
{
var ctl;
ctl=parent.document.forms[0].postCounter;
i = parseInt(ctl.value);
i=i+1;
ctl.value = i;
if (parseInt(i)<12)
{
document.forms[0].submit();
}
else
{
clearInterval(t);
}
}
</SCRIPT>
</head>
<body onLoad="load();">
<form> FORM TO POST GOES HERE</form>
</BODY>
</HTML>