T
tomromanul
Hi all,
I built a Windows Froms user control and I use it in IE 6+. It
functions properly (it displays properly in IE and executes code, such
as displaying a message box), except that in the web page I cannot do
any scripting (javascript) against it. This control has a public
property Text2, which is initialized properly:
<object id="simpleControl1"
classid="http:WinControlCS.dll#WinControlCS.WinControl"
height="300" width="300" VIEWASTEXT>
<param name="Text2" value="123" />
</object>
However, when I try to get/set this property in JS, it won't work, I
get 'undefined':
<script>
function ChangeText() {
text1.value=simpleControl1.Text2;
}
</script>
If I don't specify the property Text2, I get '[object]':
<script>
function ChangeText() {
text1.value=simpleControl1;
}
</script>
This suggests me that the object simpleControl1 exists, but I just
don't know how to access the Text2 property in JS.
I set full trust for the Local Intranet, no luck.
FYI, there is a sample online at gotdotnet and if I point the browser
to it, it works:
http://samples.gotdotnet.com/quickstart/winforms/Samples/IeSourcing/VB/IESourcing.htm
This example passes a value to the Text property of the control,
similarly with I'm trying to do.
I tried with and without this line with no luck: <param name="Text2"
value="123" />
I tried a builtin property, BackColor, with exactly the same result: It
can be initialized, but it cannot be changed in JS.
I tried with controls written in both C# and VB. Here is the C#
version:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WinControlCS
{
public partial class WinControl : UserControl
{
public WinControl()
{
InitializeComponent();
}
private void WinControl_Load(object sender, EventArgs e)
{
}
public string Text2
{
get { return richTextBox1.Text; }
set { richTextBox1.Text = value; }
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(richTextBox1.Text);
}
private void openToolStripMenuItem_Click(object sender,
EventArgs e)
{
MessageBox.Show("Click File/Open");
}
}
}
I use VS 2005 on XP sp2.
Please help. I am stuck as I don't find any information on newsgroups.
Thanks
Tom
I built a Windows Froms user control and I use it in IE 6+. It
functions properly (it displays properly in IE and executes code, such
as displaying a message box), except that in the web page I cannot do
any scripting (javascript) against it. This control has a public
property Text2, which is initialized properly:
<object id="simpleControl1"
classid="http:WinControlCS.dll#WinControlCS.WinControl"
height="300" width="300" VIEWASTEXT>
<param name="Text2" value="123" />
</object>
However, when I try to get/set this property in JS, it won't work, I
get 'undefined':
<script>
function ChangeText() {
text1.value=simpleControl1.Text2;
}
</script>
If I don't specify the property Text2, I get '[object]':
<script>
function ChangeText() {
text1.value=simpleControl1;
}
</script>
This suggests me that the object simpleControl1 exists, but I just
don't know how to access the Text2 property in JS.
I set full trust for the Local Intranet, no luck.
FYI, there is a sample online at gotdotnet and if I point the browser
to it, it works:
http://samples.gotdotnet.com/quickstart/winforms/Samples/IeSourcing/VB/IESourcing.htm
This example passes a value to the Text property of the control,
similarly with I'm trying to do.
I tried with and without this line with no luck: <param name="Text2"
value="123" />
I tried a builtin property, BackColor, with exactly the same result: It
can be initialized, but it cannot be changed in JS.
I tried with controls written in both C# and VB. Here is the C#
version:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WinControlCS
{
public partial class WinControl : UserControl
{
public WinControl()
{
InitializeComponent();
}
private void WinControl_Load(object sender, EventArgs e)
{
}
public string Text2
{
get { return richTextBox1.Text; }
set { richTextBox1.Text = value; }
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(richTextBox1.Text);
}
private void openToolStripMenuItem_Click(object sender,
EventArgs e)
{
MessageBox.Show("Click File/Open");
}
}
}
I use VS 2005 on XP sp2.
Please help. I am stuck as I don't find any information on newsgroups.
Thanks
Tom