|
-
Oct 19th, 2004, 06:09 PM
#1
Thread Starter
Banned
How to add vb6 activex component into...
im creating a activex component in vb6.0 which sends tasks.
I want to utilize this activex control on an ASP.net web page...
Lets say I ve created the ocx (compiled it) and what not..and I go into Visual Studio.net...I create a new project..I have webform1.aspx...I want to add this user control activex from vb6.0 to this page...what files do I need to "add". How do I add this user control.
Also after adding it how do I call a property or method of it...
I have been trying to do this with some problems. I cannot seem to figure out how to physically add this active x component into vs.net.
Anyone with some info please
(Posting this in vb.net and asp.net since they are all related)
Thanks,
Jon
-
Oct 19th, 2004, 06:14 PM
#2
Thread Starter
Banned
Re: How to add vb6 activex component into...
If it helps here is my code in vb6.0
First off I refernece outlook olb 10.0 or 11.0 one of those forget...
I needed some properties to store the name, subject, body, and to fields:
VB Code:
Option Explicit
Private strSubject As String
Private strBody As String
Private strResp As String
Private strOptional As String
Then I created let's and gets for setting and retreiving these properties
VB Code:
Public Property Let Subject(Value As String)
strSubject = Value
End Property
Public Property Get Subject() As String
Subject = strSubject
End Property
Public Property Let Body(Value As String)
strBody = Value
End Property
Public Property Get Body() As String
Body = strBody
End Property
Public Property Let Responsible(Value As String)
strResp = Value
End Property
Public Property Get Responsible() As String
Responsible = strResp
End Property
Public Property Let OptionalResponsible(Value As String)
strOptional = Value
End Property
Public Property Get OptionalResponsible() As String
OptionalResponsible = strOptional
End Property
Then I create task...NOTE that I am just testing right now so code might not be elite 
VB Code:
Public Sub CreateTask()
On Error GoTo Err_Handler
Dim NameSpace As Object
Dim EmailSend As TaskItem 'for the task
Dim EmailApp As Object
Set EmailApp = CreateObject("Outlook.Application") 'using the outlook object
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(3) '3 = an outlook task
EmailSend.Subject = "test"
EmailSend.Body = "test"
EmailSend.Recipients.Add (strResp) 'add the recipient
EmailSend.Assign 'assign task to recipient
EmailSend.Send 'send the task
MsgBox "The request has been e-mailed successfully to '" & strResp & "'.", vbInformation, "Request Sent Successfully"
Done:
Set EmailSend = Nothing
Set NameSpace = Nothing
Set EmailApp = Nothing
Exit Sub
Err_Handler:
MsgBox Err.Description, vbCritical, "Error #: " & Err.Number
Resume Done
End Sub
Then I just created a button to call it
VB Code:
Private Sub Command1_Click()
CreateTask
End Sub
Ideally once I get this working for this cheap example Ill use the properties get / let to pass text from web controls to these entities and have it send the task.
So if someone can even please use my code and maybe post their entire VS.net solution as an aspx project. Or even give me some steps in getting this to work.
Woka anyone I know you're out there!
Thanks,
-
Oct 19th, 2004, 06:49 PM
#3
Thread Starter
Banned
ok...
Found out how to add it to the tool bar...so I drag and drop it...and its on my page now...
Now lets say I create a button in asp.net. And I want to call this java script function...its just not working.
Here is my code behind for the aspx page:
VB Code:
Imports Project1
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Protected p As UserControl1
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Me.Button1.Attributes.Add("onClick()", "doStuff();")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
End Class
Finally here is the HTML
VB Code:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication2.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<OBJECT id="myActiveX" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 88px" classid="clsid:CD116C7E-1D49-4B29-9660-68B715DEB4CD"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8467">
<PARAM NAME="_ExtentY" VALUE="2381">
</OBJECT>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 312px; POSITION: absolute; TOP: 56px" runat="server"
Text="Button"></asp:Button>
<script language="javascript">
<!--
function doStuff()
{
myActiveX.Subject = "The subject or a reference to a subject text box"
myActiveX.Body = "the body or a reference again"
myActiveX.CreateTask
}
-->
</script>
</FONT>
</form>
</body>
</HTML>
So I put in a break point and it goes to the page load and adds that attribute. Any time I click the button it just does a post back going into the page load event.
Is the function even working cause it doesnt seem like its "Creating a task" via the create task method...if i place a button in the actual activex vb6 user control and click that button it works...but when I click the button on the asp.net page nothing...its like that JS just never runs...I just get a post back. The browser gives me a message also saying are u sure u want to run this active x component which I click yes..but nothing...
Please advise, I am very close to getting this. As soon as I get it I am gonna write up instructions and feed the community.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|