sde Posted May 1, 2004 Posted May 1, 2004 i have an experiment i'm working on and i would like to know if anyone has any suggestions on how i can accomplish this. i have a windows form with a com web browser component inside of it. the web page loaded in the web browser component has 4 radio buttons and a submit button. i want to make 4 windows buttons, that correspond with the 4 radio buttons in the web page. when any 1 button is pressed, it targets and selects the radio button on the web page. then i have a 5th button that i would like to target the submit button. the web page could exist inside the program as i've explained, or outside the program in another browser, .. i just want to make an external control which can interact with the web page. Quote codenewbie
*Experts* Nerseus Posted May 2, 2004 *Experts* Posted May 2, 2004 I know you can interact with the WebBrowser control. There was a "trick" posted here a few months ago (maybe 6-12 months ago even). I know divil was involved in the thread, so you may try searching some old posts, especially using the name of the control (axwebbrowser or whatever it is). The idea was to get a .NET object that represents the Document object of the current page (I think). You could then interact with the page, receiving events and setting properties - at least, that's what I vaguely remember about the topic. Vague? Ah well, it's Saturday and I've 40 more hours of work to do in 2.5 days :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
sde Posted May 2, 2004 Author Posted May 2, 2004 thank you. this helps me ask my question better. i need to target an html form field inside the browser control from the windows app. this is code i saw in vb that would do it: AxWebBrowser1.Document.forms(0).All("UserAccount").value = "username" however, i don't get any elements after the 'Document' property. axWebBroser1.Document. <-- there is no forms or anything else. according to that vb example, then this should work in c# axWebBrowser1.Document.forms[0].All["username"].value = "test"; any ideas on how i can accomplish this? Quote codenewbie
*Experts* Nerseus Posted May 2, 2004 *Experts* Posted May 2, 2004 Here are two threads that may work for you (sorry I didn't have these last night - too late for me to do anything helpful). http://xtremedotnettalk.com/showthread.php?t=69218&highlight=browser+event http://www.xtremedotnettalk.com/showthread.php?s=&threadid=69047 -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
bri189a Posted May 3, 2004 Posted May 3, 2004 thank you. this helps me ask my question better. i need to target an html form field inside the browser control from the windows app. this is code i saw in vb that would do it: AxWebBrowser1.Document.forms(0).All("UserAccount").value = "username" however, i don't get any elements after the 'Document' property. axWebBroser1.Document. <-- there is no forms or anything else. according to that vb example, then this should work in c# axWebBrowser1.Document.forms[0].All["username"].value = "test"; any ideas on how i can accomplish this? The vb works because it uses late-binding, the C# you will have to cast everything prior, it does not use late binding...that's why you don't see anything. I did something similiar once at an old job... they used the most horrible time-sheet web-based programs... looked like it was made my a 12 year old... had more pointless script in it then you could believe... I mean think about it...43 pages of code this thing had just to enter the time you worked...but I digress... I prefer C# myself, but in this instance I made a class that did the interacting in VB...compiled it as a DLL and then referenced it in my C# forms based project. Quote
sde Posted May 4, 2004 Author Posted May 4, 2004 thanks. yes that got it to work. i just had to declare an HTMLDocument and make it = axWebBrowser1.Document. thanks again. Quote codenewbie
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.