Link to home
Start Free TrialLog in
Avatar of Replica178
Replica178

asked on

VB.NET and Web Forms

Hi All.
I Have one problem
On web form,i have one link thats open when you click.
When its open,You have a text Area.
I must to insert text from my richtextbox into that textarea.
The code of that textArea is:
<body id="tinymce" class="mceContentBody " spellcheck="false" dir="ltr"><p><br mce_bogus="1"></p></body>

Open in new window

I tried to use this code:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Try
            WebBrowser1.Document.GetElementById("tinymce").InnerText = RichTextBox1.Text
        Catch ex As Exception
        End Try

Open in new window

But it doesnt Work.
I HAVE VB.NET
Thank You
Sorry For My English,I'm Russian
Avatar of honestman31
honestman31

try this
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Try
            WebBrowser1.Document.All.Item("tinymce").Value = RichTextBox1.Text
        Catch ex As Exception
        End Try

Open in new window

Avatar of Replica178

ASKER

Doesn't work
I think you are using tinymce  which not A text area as you mentioned ,
Can you please attach ( or post a link to  the URL ) that has the tinymce
try those please




Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Try
            WebBrowser1.Document.All.Item("tinymce").outerhtml = RichTextBox1.Text
        Catch ex As Exception
        End Try


And this one too


Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Try
            WebBrowser1.Document.All.Item("tinymce").innerhtml = RichTextBox1.Text
        Catch ex As Exception
        End Try
Doesn't Work (
this should work :)
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Try
          Call WebBrowser1.Document.parentWindow.execScript("tinyMCE.activeEditor.setContent(RichTextBox1.Text);", "JavaScript")
        Catch ex As Exception
        End Try

Open in new window

This is for VB 6.0,but i have VB.NET
Well , I still use VB6  so I think the problem is the CALL
so I suggest u replace CALL with t=
Make sure T is declared
Like this  



t= WebBrowser1.Document.parentWindow.execScript("tinyMCE.activeEditor.setContent(RichTextBox1.Text);", "JavaScript")

Open in new window

the problem is parentWindow
ASKER CERTIFIED SOLUTION
Avatar of honestman31
honestman31

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
error 80020101
Well , I have to install VB.net to check on that , will get back to u tomorrow then
ok.thank you
Avatar of Nasir Razzaq
Are you trying to show text in a control that is a different page?
yes.I tried.Its not differrent
>yes.I tried.Its not differrent

Now "yes" means that its separate pages but then you contradict yourself by saying "its not different".

If you want to copy text to a text area on a page from a richtextbox on a different page, you may have to use session (query string is an option but I am assuming that text would be long so its not suitable).
i tried this
 
WebBrowser1.Document.Window.DomWindow.execscript("tinyMCE.activeEditor.setContent('<span>Richtextbox1.Text</span>')", "JavaScript")

Open in new window

Its Perfectly Work,But it Write Richtextbox1.Text,but i need the Richtextbox1.Text value
>But it Write Richtextbox1.Text,but i need the Richtextbox1.Text value

It writes Richtextbox1.Text but you want the Richtextbox1.Text??? Your English is not that weak is it?
I'M RUSSIAN!
In textArea it WRITE "RICHTEXTBOX1.TEXT" - IT's A TEXT
I NEED TO WRITE THE RICHTEXTBOX1.TEXT VALUE!!!!!!!

As I said, if the richtextbox and the textarea are on two separate pages, try using the session.

Or are both controls on same page?
WebBrowser1.Document.Window.DomWindow.execscript("tinyMCE.activeEditor.setContent('<span>" + RichTextBox1.Text + "</span>')", "JavaScript")

Open in new window

IT's WORK .
honestman31 THANK YOU!
THANK YOU