473,382 Members | 1,647 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,382 software developers and data experts.

Getting NullReferenceException

Hi,
Below is what I am doing -
Expand|Select|Wrap|Line Numbers
  1. private void Example()
  2. {
  3.   try
  4.   {
  5.    HtmlDocument htmlDocument=webBrowser1.Document;
  6.    HtmlElement newApplication=htmlDocument.GetElementById("menu:StartupPage_NewApplication_NewApplication_Consumer");
  7.  
  8. //On below line it is throwing exception
  9. newApplication.InvokeMember("Click");
  10. }
Mar 12 '13 #1

✓ answered by r035198x

Still you are getting the NullReference because GetElementById is not finding anything. So check that your syntax for locating the element is correct and the names match according to the method's standards.

3 1241
r035198x
13,262 8TB
Probably newApplication is still null at that point because
Expand|Select|Wrap|Line Numbers
  1. GetElementById("menu:StartupPage_NewApplication_NewApplication_Consumer" );
didn't find what it was looking for. You can put Console.WriteLines to see if that is the case.
Mar 12 '13 #2
Hi,
Thanks for youe reply.
NewApplication is the menu on one webpage. I am opening the webpage using the webbrowser control and after that trying to click the "NewApplication" option.
Mar 12 '13 #3
r035198x
13,262 8TB
Still you are getting the NullReference because GetElementById is not finding anything. So check that your syntax for locating the element is correct and the names match according to the method's standards.
Mar 12 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: G-Fit | last post by:
Hello group, I'm trying to understand what happened to one of our team member today. He's getting NullReferenceException on any .aspx from our project he tries to browse, the error pointing to...
2
by: J M | last post by:
Getting NullReferenceException walking through printer properties: ObjectQuery names = new ObjectQuery("SELECT * FROM Win32_Printer"); ManagementObjectSearcher printQueues = new...
1
by: Samuel R. Neff | last post by:
We just started getting NullReferenceException in one of our applications on our demo server. This is occuring in a .NET Windows Service that is using binary remoting over TCP to talk to another...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
1
by: msnews.microsoft.com | last post by:
I'm trying to fill an array of objects but when I add the first object I get a NullReferenceException. ----------------------------------------------------------------------------...
0
by: roopsd | last post by:
Hi Thank you for yuour help. I am using VS.NET 2003 with Crystal XI r2. I am getting NullReferenceException at the following line in my code. oRptForm.crystalReportViewer.ReportSource =...
1
by: mdhaman | last post by:
hi, I have a windows service written in VB.Net and framework 2.0. It is a multithread service and it is using threadpool to manage threads. Recently I have started getting...
1
by: RamyaBhaskaran | last post by:
I have created an application inwhich in the form i have written the following code namespace WindowsApplication5 { public partial class Form1 : Form { public Form1() ...
3
by: Sagar | last post by:
Hi. I am working on a project to migrate a web application from 1.1 to 2.0 Within in the DAL of the application, there is a call to below function that builds a command object for later use. ...
3
by: Cirene | last post by:
I'm creating my own create user wizard. Here's my code... If Membership.GetUser(txtEzUsername.Text).ProviderUserKey.ToString <"" Then Me.lblStatus.Text = "Username is in use. Please select...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?

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.