473,624 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing a form object in a page by using WebBrowser component?

Hi group,

Here's a problem I've been trying to solve for the past several weeks. I
have the standard WebBrowser object added to a form so it can access
websites, and I have it load a default page once the form is launched. I
now want to automatically fill out a specific text-field found within the
web-page that the WebBrowser object has open. Right now I am using the
following code to accomplish it:

webBrowser.Docu ment.Forms(0)(1 ).Value = "Test Text"

But I am faced with a major complication when I use the above method. The
page in question is often changed and more form objects (hidden and visible)
are added, or the order of the form objects are changed. When this happens,
I have to manually go through and change the form position or the program
will error out or the text will be entered in the wrong text-field, when it
tries to add the text to the currently specified form object of (0)(1). To
make matters even worse, the page that loads will reflect what the user
selects previously, and depending on the selection the amount of form
objects on the page will change.

My question is... How can I simply search through the page and find the
NAME of the form-object I want to modify? For example, if the text-field I
want to insert the text into has a name of 'XYZ' in the HTML document, how
can I search through the page using Visual Basic and locate that element,
then once its found insert the correct text? The only element of the page
that I can seemingly do this with is the actual submit button, and I use the
code:

webBrowser.Docu ment.All("Butto n").Click [ Will submit the form ]
webBrowser.Docu ment.All("Butto n").Value = "Name of Button" [ Will change the
name of the button ]

When I try simular code to change the value of a text field, I get the
error: 'Object doesn't support this property or method'. So what is the
magical command to do what I am asking? I have searched MSDN and forums for
an answer, but all I can find is similar to the first line of code I
mentioned here. Is there a way to do this, it sounds like an easy task but
I can't get it to work! Thanks in advance,

Matt
Jul 17 '05 #1
1 6362
"Matt" <no**@thenewsgr oups.com> wrote in message
news:qq******** ************@tz net.com...
Hi group,

Here's a problem I've been trying to solve for the past several weeks. I
have the standard WebBrowser object added to a form so it can access
websites, and I have it load a default page once the form is launched. I
now want to automatically fill out a specific text-field found within the
web-page that the WebBrowser object has open.


I think I found the answer! I'm now using code along the lines of:

webBrowser.Docu ment.Forms(0).N ameOfField.Valu e = "Whatever"

And that seems to have done the trick, so please disregard my initial
question. Unless of course you know of another alternative way that is even
better. I still haven't fully tested my solution, but I don't see why there
should be any problem.

Matt
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1911
by: egg | last post by:
Dear Sir/Madam, I'm about to start a project, the idea is to have a web interface to let user specify the URL of a target HTML document, based on that URL, retrieved and parsed the HTML document using the DHTML object model exposed by ActiveX control WebBrowser, getting the position and dimension of each node inside the HTML document, processed it and pass the result back to the user as a new HTML document.
4
1961
by: Wim Verhavert | last post by:
Hi all, For gathering certain information in building my database, I'm depending on the things I found on the web, especially one website (let's call it www.mywebsite.com). Is there a way to query this site (it has fill in boxes on the page and a search button) depending on values in my form and getting the results back in my form? This (general) question is keeping me out of my sleep for weeks now.... Any tip is appreciated....
7
6517
by: Mike | last post by:
Hi! I posted this question in browser_ctl group as well but got no results. I have a form with embedded WebBrowser. Upon clicking on a link in the embedded webbrowser that calls JavaScript's window.open() call where I pass different width, height, top, left and other parameters, I open a new form of the same type as the original. I noticed that the webbrowser in the newly opened form is shifted to the right and bottom leaving gray areas...
5
1953
by: Mike Tadd | last post by:
I am developing a Application for a Project at Uni, and I have made a web browser on a form. It works when I have the form as its own window, but when I put it in a MDI it dorsnt work. Does anyone know a way around this?? thanks -- ------------ Mike Tadd
2
7185
by: jasonhartsoe | last post by:
I'm using Visual Studio 2005 Team Edition....using visual basic. I'm trying to use the webbrowser control. In the webbrowser control I have it got to a page where there is a form. It waits for the page to complete, then fills in the form. Next I want it to submit the form or after getting focus of the submit button, keys.enter. I've tried everything but without any luck...and the old codes, webbrowser.forms(0).submit or .click etc no...
5
57828
by: Kimmo Laine | last post by:
Hi is there a way to change propertys attribute from the code? Let´s say that i have the following property in my class: public int Count } Is there a way to change the displayname, from my code, at runtime to "Number of bikes".
2
2259
by: Matt Brown - identify | last post by:
Hello, I'm very new to this level of programming and .net in general. My background is VB. I am attempting to use the WebBrowser control to load a flash movie, and it is a known issue that the WebBrowser control doesn't natively support mouse clicks (unless the form loses and regains focus).
4
13343
by: Robson Siqueira | last post by:
Folks, I am facing a problem. I am trying to manipulate the HTML data (thru the Document and DocumentText properties) of the WebBrowser object (System.Windows.Forms). The problem is that the application enters in a loop state and my changes don't apply. Have somebody faced the same problem? Any solutions?
6
3290
by: Martin Slater | last post by:
Hi all, I'm using a webbrowser control within an application for the UI and want to hide the flicker and redraw when changing pages. Ideally I want to render the new page to a seperate offscreen buffer then fade this over the exisiting page. Can anyone recommend a good way to approach this? thanks
0
8236
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8173
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8679
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8475
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2606
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.