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

problem relating AxWebBrowser control in Visual Studio 2003

i am using AxWebBrowser in C# project. i add and on click event handler on the document on Document Completed event. code is given below

mshtml.HTMLDocument doc1=(mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.HTMLDocumentEvents2_Event eve=(mshtml.HTMLDocumentEvents2_Event)doc1;
eve.onclick+=new HTMLDocumentEvents2_onclickEventHandler(eve_onclic k);

its firing ok but the problem is this that if i click a text box, it doesnt get the focus and i cannot type in it.

i will be very thankfull if anyone can help me out here.
Feb 19 '07 #1
10 2468
kenobewan
4,871 Expert 4TB
What does this onclick event do?
Feb 20 '07 #2
it gets the element clicked, then search in the Treeview created from html returned and returns wether its the same one or not.



i removed this handler DocumentComplete event handler and all the things returned to normal. i mean to say that text boxes got their focus.i then put the same code in NavigateComplete2 event and it seized to work again.
Feb 20 '07 #3
kenobewan
4,871 Expert 4TB
Please post the code for the event, I assume that you mean ceased.
Feb 21 '07 #4
yes i meant cease. and the code u asked for. its given below

Expand|Select|Wrap|Line Numbers
  1. private void axWebBrowser1_DocumentComplete(object sender, System.EventArgs e)
  2.         {
  3.             progressBar1.Increment(progressBar1.Minimum+=15);
  4.             string url=axWebBrowser1.LocationURL;
  5.             prurl=url;
  6.  
  7.             this.comboBox1.Items.Add(axWebBrowser1.LocationURL);
  8.             ImageList ls=new ImageList();
  9.             ls.Images.Add(Image.FromFile("exxp.gif"));
  10.             ls.Images.Add(Image.FromFile("txt.gif"));
  11.             treeView.ImageList=ls;
  12.             if(newproject)
  13.             {
  14.                 newproject=false;
  15.                 TreeNode tnod=new TreeNode("Sequence ");
  16.                 tnod.Nodes.Add(new TreeNode(url,1,1));
  17.                 treeView.Nodes.Add(tnod);
  18.             }
  19.             else
  20.             {
  21.                 treeView.Nodes[0].Nodes.Add(new TreeNode(url,1,1));
  22.             }
  23.  
  24.             mshtml.HTMLDocument doc1=(mshtml.HTMLDocument)axWebBrowser1.Document;
  25.             mshtml.HTMLDocumentEvents2_Event eve=(mshtml.HTMLDocumentEvents2_Event)doc1;
  26.             eve.onclick+=new HTMLDocumentEvents2_onclickEventHandler(eve_onclick);
  27.  
  28.             status="Done";
  29.             sbstatus.Text="Done";
  30.             string code=this.LoadFile();
  31.             if(!code.Equals(""))
  32.             {
  33.                 IHTMLDocument2 doc = (IHTMLDocument2) this.axWebBrowser1.Document;
  34.                 if (doc != null)
  35.                 {
  36.                     IHTMLWindow2 parentWindow = doc.parentWindow;
  37.                     if (parentWindow != null)
  38.                         parentWindow.execScript(code, "javascript");
  39.                 }
  40.             }
  41.             Cursor.Current = Cursors.Default;
  42.             progressBar1.Increment(progressBar1.Minimum+=20);
  43.             string a=this.axWebBrowser1.LocationURL.ToString();        
  44.             this.sbstatus.Text="Loading..."+a;
  45.             this.comboBox1.SelectedItem=a;
  46.             show_html_code(a);
  47.             this.ProcessHTML(htmlCode);                    
  48.             count++;    
  49.  
  50.         }
Feb 21 '07 #5
kenobewan
4,871 Expert 4TB
Please post the eve_onclick event code. Thanks.
Feb 22 '07 #6
sorry i misunderstood. here is the code for onclick event

Expand|Select|Wrap|Line Numbers
  1. private bool eve_onclick(IHTMLEventObj pEvtObj)
  2.         {
  3.  
  4.             if(RecOn)
  5.             {
  6.  
  7.                 //DataRow dr=dtrob.NewRow();
  8.                 if(rdbdload.Checked)
  9.                 {
  10.                     //dr[0]=act;
  11.                 }
  12.                 else if(rdbfrmsmt.Checked)
  13.                 {
  14.                     //dr[0]=act;
  15.                 }
  16.                 else if(rbnav.Checked)
  17.                 {
  18.                     //dr[0]=act;
  19.                 }
  20.                 else if(rdbtxtext.Checked)
  21.                 {
  22.                     //dr[0]=act;
  23.                 }
  24.                 else
  25.                 {    
  26.                     MessageBox.Show("Please select an action from the given options","Info Message",MessageBoxButtons.RetryCancel,MessageBoxIcon.Information);
  27.                     return false;
  28.                 }
  29.  
  30.                 HtmlParser parser=new HtmlParser();
  31.                 mshtml.IHTMLElement ele=pEvtObj.srcElement;            
  32.                 string strrr=ele.outerHTML;
  33.                 HtmlDocument ddoc=HtmlDocument.Create(strrr,false);
  34.                 TreeNode tnod=tvwDOM.Nodes[0];
  35.                 HtmlNodeCollection hnod=ddoc.Nodes;
  36.                 //If HtmlDocument contains only one parent node for such nodes which can be converted to DOM otherwise all nodes are given 
  37.  
  38.                 builder.Clear();
  39.                 if(hnod.Count>1)
  40.                 {
  41.                     for(int n=0;n<hnod.Count;n++)
  42.                     {
  43.                         HtmlNode nn=hnod[n];
  44.                         builder.Add(nn.ToString());    
  45.                     }
  46.                 }
  47.                 else
  48.                 {                        
  49.                     Builder(ddoc.Nodes[0],true,"nor");
  50.                 }
  51.                 builder.TrimToSize();
  52.                 URList.Add(prurl);
  53.                 tnod=check(tnod,builder,true);/// this function searches a tree and return the node of the tree being searched
  54.                 if(tnod!=null)
  55.                 {    
  56.                     string str=tnod.FullPath;
  57.                     drrob[2]=str;
  58.                     URList.Add(str);
  59.                 }
  60.                 else
  61.                 {
  62.                             /// Node not found    
  63.                             URList.Add(null);
  64.                 }    
  65.                 //System.Xml.XmlTextWriter twriter=new XmlTextWriter(
  66.                 drrob[3]=axWebBrowser1.LocationURL;
  67.                 dtrob.Rows.Add(drrob);
  68.             }    
  69.  
  70.             return true;
  71.         }
Feb 24 '07 #7
kenobewan
4,871 Expert 4TB
i removed this handler DocumentComplete event handler and all the things returned to normal. i mean to say that text boxes got their focus.i then put the same code in NavigateComplete2 event and it seized to work again.
I can't see the NavigateComplete2 event in your code, did you take it out to show the rest of the code?
Feb 24 '07 #8
iam sending all the events i defined on the axsebbrowser

private void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Even t e)
{
status=sbstatus.Text;
string a=this.axWebBrowser1.LocationURL.ToString();
//show_html_code(a);
progressBar1.Increment(progressBar1.Minimum+=15);

}

private void axWebBrowser1_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
{
string urlsrt=e.uRL.ToString();
progressBar1.Increment(progressBar1.Minimum+=15);
}


rest u already have.
Feb 25 '07 #9
kenobewan
4,871 Expert 4TB
I believe that NavigateComplete2 is not the right event to use here. If navigation to a site is successful, the NavigateComplete2 handler is called, if available. Here is an article that may help:
Component-Based Development with Visual C#
Feb 26 '07 #10
actually i am using navigate event to increment the status bar.
All three of the events fire.
the link u sent me is very helpful. i am trying to sort out the problem but still not a solution yet.
Feb 26 '07 #11

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

Similar topics

0
by: Rajesh Kumar | last post by:
Hi Gregory Thanks for your answer. I did not see any attached file so I copied your text into a text file and named it compiler.bat Checked the wrapped lines and runned the file. It said Dataset,...
0
by: Rajesh Madhra | last post by:
Hi Gregory Thanks for your answer. I did not see any attached file so I copied your text into a text file and named it compiler.bat Checked the wrapped lines and runned the file. It said Dataset,...
8
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be...
13
by: Lee Newson | last post by:
Hi, I have just written my first application using VB.NET. The app works fine when i am running it within .NET for debugging purposes, however when i try to run the app from the .exe file that...
13
by: Udhay | last post by:
I am trying to use the AxWebbrowser control in my VB.Net application. The control is placed on one of the tab pages in the form. This is the error I am getting when I have the 'exceptions' set to...
0
by: Rich | last post by:
(1) Is there a better place to pose the question below? (2) I am starting to convert my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 Professional (.NET v2.0.50727). The entire...
2
by: Vicente García | last post by:
hello all, Sorry for my English. I am making up an application and I must show a web. The web contains a power point but I have a problem because I type something like: AxWebBrowser.Navigate(URL) ...
1
by: Claire | last post by:
I'm using C# in Visual Studio 2003, XP pro with latest IE plus all patches and security updates. I imported microsofts web browser control onto my tool palette from the COM tab of "Add/remove...
4
by: vedrandekovic | last post by:
Hi, I have already install Microsoft visual studio .NET 2003 and MinGw, when I try to build a extension: python my_extension_setup.py build ( or install ) , I get an error: LINK : fatal...
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,...
0
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...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.