Click here to Skip to main content
15,878,543 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I m using Visual Studio 2008 framework 3.0,

I have created a editor in windows form with web browser control and adding html tags to it and saving to database.... and i m able edit text and enter text in web browser control in Windows XP, In windows 7 i m unable to enter single letter into it.. please help me to over come this problem...
Posted
Updated 11-Oct-11 0:45am
Comments
Sergey Alexandrovich Kryukov 11-Oct-11 11:26am    
Who knows where did you screw up? Make a code sample (as small as you can) manifesting your problem and post it using "Improve question".
--SA
grimmuko 19-Oct-11 19:23pm    
another source of the problem might be an other version of internet explorer the setting for active-x ....

i have got the solution

A Windows Forms based text editor with HTML output[^]

Need to add code in the editor.cs and you can find code in the comments in the above link.


private void theBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
// Existing Code here....

HTMLDocument HTMLDocument =
(HTMLDocument)doc;

((HTMLDocumentEvents2_Event)HTMLDocument).onkeypress += new
HTMLDocumentEvents2_onkeypressEventHandler(this.On_KeyPressEvent);

}

private bool On_KeyPressEvent(mshtml.IHTMLEventObj e)
{
if (e.ctrlKey &&
(e.keyCode == 86 || e.keyCode == 118))
{
MessageBox.Show("Pasted");
}
return true;
}
 
Share this answer
 
'Try this coding to be added
'This is due to some control conflict between the internet explorer and Windows OS


Private Sub webBrowser1_DocumentCompleted1(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles webBrowser1.DocumentCompleted
If webBrowser1.Version.Major >= 9 Then
webBrowser1.Document.Write(webBrowser1.DocumentText)
doc.designMode = "On"
End If
End Sub

'for C#.NET
-----------
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (webBrowser1.Version.Major >= 9)
{
webBrowser1.Document.Write(webBrowser1.DocumentText);
doc.designMode = "On";
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900