Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , , , , , ,

Sponsored Links



Javascript using C# WinForm

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 03-12-2009
Member
 
Join Date: Nov 2009
Posts: 83
Javascript using C# WinForm

Hello folks,

I am developing a program using the C# programing language. But the problem arise with the Javascript. I want to call Javascript in my code using the C# Winform, but i am not aware of the method to implement it using the same. So any one have knowledge regarding this can help me as i am a fresher so haven't much idea about the code. Is it possible to do so. A help may be appreciated.

Thanks in advance
Reply With Quote
  #2  
Old 03-12-2009
Eric B's Avatar
Member
 
Join Date: Apr 2008
Posts: 4,645
Re: Javascript using C# WinForm

Hi there,

If you want to use Javascript in a web page then i can help you with the procedure to call the same using C# Winform. The web page itself contain the control for the same. If you are discussing about the same then the Web Browsers Document property has an InvokeScript method which will automatically do the same.

Code:
this.WebBrowser.Document.InvokeScript("foo", new string[] { "Hiiiiiiiii" });
Say thanks if it is working.
Reply With Quote
  #3  
Old 03-12-2009
Glenny's Avatar
Member
 
Join Date: May 2008
Posts: 4,550
Re: Javascript using C# WinForm

Hi,

I have the same issue as you are facing and i solved it with the Microsoft.mshtml library" to do this. This can help to call the javascript using the C# WinForm.

Here is the code:

Code:
mshtml.IHTMLDocument doc = (mshtml.IHTMLDocument)axwebBrowser.Document;
mshtml.IHTMLWindow parentWin = doc.parentWindow;
parentWin.execScript("test(100)", "javascript");
Reply With Quote
  #4  
Old 03-12-2009
JonathanD's Avatar
Member
 
Join Date: May 2008
Posts: 4,325
Re: Javascript using C# WinForm

Hi,

I something to tell you that you cant use C# to call the JavaScript because it is not a engine to perform the same. Only Internet Explorer can use JavaScript because it has the engine to do the same. And if you want to access DOM then you can do that with XmlDocument or XmlDataDocument classes. Web Browser control also have the functionality to do the same.

Thanks.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Javascript using C# WinForm"
Thread Thread Starter Forum Replies Last Post
.net grid winform app s398290 Windows Software 1 07-09-2011 12:05 PM
high performance grid for the .Net winform application zannxy Software Development 1 29-08-2011 04:31 PM
Javascript in IE on HTC HD2 dONGsUN Portable Devices 4 06-10-2010 06:56 AM
help with javascript please! newbie1 Software Development 2 08-05-2010 12:09 PM
Unobtrusive Javascript hatred Software Development 3 08-09-2009 02:03 PM


All times are GMT +5.5. The time now is 03:48 AM.