Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Getting a userControl working in IE using VB
 

Getting a userControl working in IE using VB

HELP!!!!! Im going nuts here trying to figure this out!!!

Im trying to write a usercontrol, which will allow you to set and get values from an internet explorer window using javascript. I have tried for months on and off trying to get this working, but cant. Please HELP!!!!!

The line 'myControl1.getUserText' just gives me 'Undefined'

Any ideas, please!!!!!


-------------------------------------------------------------------------------------------------------------
HTMLCode
-------------------------------------------------------------------------------------------------------------
<html>
<body color=white>
<hr>
<font face=arial size=1>
<OBJECT id="myControl1" name="myControl1" classid="userControlTest1.dll#ClassLibrary1.UserControl1">
</OBJECT>
</font>
<form name="frm" id="frm">
<input type="text" name="txt" value="enter text here"><input type=button value="Click me" onClick="doScript();">
</form>
<hr>
</body>
<script language="javascript">
function doScript()
{
alert(myControl1.getUserText);
}
</script>
</html>

-------------------------------------------------------------------------------------------------------------
VB.net Code
-------------------------------------------------------------------------------------------------------------
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Implements AxMyControl

Public Function getUserText() As String Implements AxMyControl.getUserText
Return "Banannas"
End Function
Public Sub setUserText(ByVal strUser As String) Implements AxMyControl.setUserText
TextBox1.Text = "Banannas"
End Sub

Public Interface AxMyControl
Sub setUserText(ByVal txtUser As String)
Function getUserText() As String
End Interface

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = Now.Second
End Sub
End Class

tonelm2  Wednesday, November 25, 2009 8:36 PM
Martin Xie - MSFT  Friday, November 27, 2009 3:21 AM
Martin Xie - MSFT  Friday, November 27, 2009 3:21 AM

In addition, here are some tutorial about: Hosting a Windows Form Control in a web page, which may be helpful to you.
http://weblogs.asp.net/spano/archive/2007/09/19/hosting-a-windows-form-control-in-a-web-page.aspx
http://www.15seconds.com/Issue/030610.htm
http://www.syncfusion.com/faq/windowsforms/faq_c101c.aspx


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Martin Xie - MSFT  Friday, November 27, 2009 3:22 AM
I think you may need to lower the security of IE to upgrade your UserControl Permissions

__________________

April

http://www.comm100.com/livechat/
april_123456  Friday, November 27, 2009 10:21 AM

You can use google to search for other answers

Custom Search

More Threads

• Question about oWrite.WriteLine
• Get list of mapped driver list ?
• How to retrieve the values of the common file properties?
• Visual Basic 2005 Question for Calling Another Program
• Socket Error
• Get local Ip Details with VB 2008/2005?
• checking radio buttons in group box
• Problem in image compression
• Accessing font file's information
• Help with codes