Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

Windows Forms Binding to HTMLElement Events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AMDRIT - 23 Jan 2007 18:35 GMT
Hello Everyone,

We have a production WinForms Application that uses a WebBrowser to display
readonly data.  In the html document we have SPAN elements that facilitate
menu selections.  We also have a TABLE object that is bound to an XML Data
Island, each row of the table has an option to "View Details" or "Delete"

When a user clicks a SPAN object we would set the WebBrowser's Status Text
to the desired command, then back to "Ready".  The windows form would then
capture the statustext change event and process the command.  We were
testing the impact IE7 has with this application and found that this
solution no longer works.

We have now decided to listen for the click events of these SPAN objects
from within the windows form.  This is working wonderful except for the SPAN
objects in the databound table.  Here in lies my question, how do we get the
click events to fire in our windows form?

Below is a snippet of code that we use to add the event handler, first for
the top level menu items, then for the menu items  on each row of the table.

   For Each objElement As HtmlElement In
objHTML.All.Item("menusection").GetElementsByTagName("SPAN")

     'Top level menu Items are seperated with " | ", so ignore them
     If Not objElement.InnerText.Contains("|") Then
       AddHandler objElement.Click, AddressOf MenuItemClicked
       Trace.WriteLine(String.Format("{0}, {1}", objElement.TagName,
objElement.InnerText))
     End If

   Next

   For Each objElement As HtmlElement In
objHTML.All.Item("menutable").GetElementsByTagName("SPAN")

       'The only two menu items that we want to listen for are "Delete" and
"View Details"
       If objElement.InnerText.Contains("Delete") Or
objElement.InnerText.Contains("View Details") Then
         AddHandler objElement.Click, AddressOf MenuItemClicked
         Trace.WriteLine(String.Format("{0}, {1}", objElement.TagName,
objElement.InnerText))
       End If

   Next

Thanks in advance
AMDRIT - 26 Jan 2007 14:49 GMT
Bump

> Hello Everyone,
>
[quoted text clipped - 46 lines]
>
> Thanks in advance

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.