473,387 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Help to Italy

Hello from Naples Italy, I need help to develop an application that
fill fields automatically in a WEB page and then submit the request. I
really need it for getting automatically rates from low cost airline
but I am testing it with Google. I am writing the following code in
VB.net

AxWebBrowser1.Navigate("http://www.google.com")

doc = Me.AxWebBrowser1.Document 'Get htmldocument

Dim ricerca As mshtml.HTMLInputTextElement =
doc.getElementsByName("q").item(, 0) 'get inputbox ref
ricerca.value = "Italy" 'Input value
Dim submitButton As mshtml.HTMLInputButtonElement =
doc.getElementsByName("btng").item(, 0)
submitButton.click() 'click the button

I get this error on the last line: An unhandled exception of type
'System.NullReferenceException' occurred in WindowsApplication1.exe
Additional information: Object reference not set to an instance of an
object

Is there anyone who can help me?
Thanks in advance.
Luca

Feb 12 '06 #1
4 1258
This error message means that the object reference is set to Nothing.

So for example if I do this.

Dim myClassInstance As MyClassType

then

myClassInstance.MyMethod

I will get the same error because I did not instantiate a new object of Type
MyClassType or set myClassInstance to reference for an existing object of
that type.

Looking at your code

doc.getElementsByName("btng").item(, 0)

You have probably made a mistake with the line here perhaps the name "btng"
is incorrect and it does not return an object.

HTH

--
Terry Burns
http://TrainingOn.net

"Luca" <vi***@tin.it> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hello from Naples Italy, I need help to develop an application that
fill fields automatically in a WEB page and then submit the request. I
really need it for getting automatically rates from low cost airline
but I am testing it with Google. I am writing the following code in
VB.net

AxWebBrowser1.Navigate("http://www.google.com")

doc = Me.AxWebBrowser1.Document 'Get htmldocument

Dim ricerca As mshtml.HTMLInputTextElement =
doc.getElementsByName("q").item(, 0) 'get inputbox ref
ricerca.value = "Italy" 'Input value
Dim submitButton As mshtml.HTMLInputButtonElement =
doc.getElementsByName("btng").item(, 0)
submitButton.click() 'click the button

I get this error on the last line: An unhandled exception of type
'System.NullReferenceException' occurred in WindowsApplication1.exe
Additional information: Object reference not set to an instance of an
object

Is there anyone who can help me?
Thanks in advance.
Luca

Feb 12 '06 #2
Thanks Terry but btng is how google calls the button, you can see it in
html page of google so my question is: why my instruction does not
return anything?
Can you help with this

Feb 12 '06 #3
Its a bit difficult without actually working on it. Suffice to say that this
is not returning the object and thats where you need to concentrate.

--
Terry Burns
http://TrainingOn.net

"Luca" <vi***@tin.it> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Thanks Terry but btng is how google calls the button, you can see it in
html page of google so my question is: why my instruction does not
return anything?
Can you help with this

Feb 12 '06 #4
Thanks Terry, I really apologize to bother you, I usually work with VB
and I am not very familiar with .net,I am getting crazy with this.
I am looking for a way to fill fields in a WEB page and update in an
Access table the result.
Please give me a line to follow and I will offer you a good pizza when
you come to Naples.

Feb 13 '06 #5

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

Similar topics

0
by: adrian.collett | last post by:
The DB2 User Group Italy(DUGI) is holding its next meetings in Rome on March 15th and in Milan on March 16th. For full details about the events, including agenda, location and registration...
2
by: Carlo, MCP | last post by:
Hi, Sorry for posting twice, but I hope in your comprehension. Please help me! I'm troubling from months with a serious serialization problem that I'm not able to solve. I try to describe as...
0
by: marco.pavanelli | last post by:
The company Net Wise - www.netwise.it is looking for a young PHP programmer (25-30) years old, peferably with some experience with EZ-Publish. The job is for local candidates only and Net Wise is...
0
by: Philippe Geril | last post by:
GAME-ON 2007 November 20 - 22, 2007 CALL FOR PAPERS University of Bologna Bologna, Italy Organized by EUROSIS-ETI
1
by: saytri | last post by:
I have a problem with this code. I'm, doing a quiz, and the questions are stored in a binary file. My problem is how am i going to compare the answers entered by the user to the correct answers. The...
1
by: racshah | last post by:
I want to validate the postal codes for 15 different countries. For this I have written the perl script shown below. In this script postal codes for Netherland, belgium, Italy, Ireland can be...
3
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.