[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 913
  • Last Modified:

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
0
Replica178
Asked:
Replica178
  • 12
  • 7
  • 4
1 Solution
 
honestman31Commented:
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

0
 
Replica178Author Commented:
Doesn't work
0
 
honestman31Commented:
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
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
honestman31Commented:
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
0
 
Replica178Author Commented:
Doesn't Work (
0
 
honestman31Commented:
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

0
 
Replica178Author Commented:
This is for VB 6.0,but i have VB.NET
0
 
honestman31Commented:
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

0
 
Replica178Author Commented:
the problem is parentWindow
0
 
honestman31Commented:
try this plz
WebBrowser1.Document.Window.DomWindow.execscript("tinyMCE.activeEditor.setContent(RichTextBox1.Text);", "JavaScript")

Open in new window

0
 
Replica178Author Commented:
error 80020101
0
 
honestman31Commented:
Well , I have to install VB.net to check on that , will get back to u tomorrow then
0
 
Replica178Author Commented:
ok.thank you
0
 
CodeCruiserCommented:
Are you trying to show text in a control that is a different page?
0
 
Replica178Author Commented:
yes.I tried.Its not differrent
0
 
CodeCruiserCommented:
>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).
0
 
Replica178Author Commented:
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
0
 
CodeCruiserCommented:
>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?
0
 
Replica178Author Commented:
I'M RUSSIAN!
In textArea it WRITE "RICHTEXTBOX1.TEXT" - IT's A TEXT
I NEED TO WRITE THE RICHTEXTBOX1.TEXT VALUE!!!!!!!

0
 
CodeCruiserCommented:
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?
0
 
Replica178Author Commented:
WebBrowser1.Document.Window.DomWindow.execscript("tinyMCE.activeEditor.setContent('<span>" + RichTextBox1.Text + "</span>')", "JavaScript")

Open in new window

IT's WORK .
honestman31 THANK YOU!
0
 
Replica178Author Commented:
THANK YOU
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 12
  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now