Wrox Programmer Forums
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2004, 09:58 AM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to little_ximuoi
Default .Net Component

i have a component by VB.Net. but i don't know hor to register it with windows, let windows(or .Net framewaork) know that it's belongs to .Net, and any application can make a reference to that component.
After i create a storng name,i use the command "regsvcs" from the .Net Command Prompt. My component appears in the tab COM of .NET(when add referrence/Com) but i can't use it.But if i add reference to the component by giving the path direcly to the .dll file ,everything works well
the flowwing code is what i did, i need help to continue work on this thing(COM+ Component). so someone plz help me. i'm using windows 2000 professional, .net 2003
//this is the component code
Imports System.EnterpriseServices
Imports System.Reflection
<Assembly: AssemblyKeyFileAttribute("BankComponent.snk")>

Public Class BankComponent
    Inherits ServicedComponent

    Public Sub Interest(ByVal pname As String, ByVal pamount As Int16, ByVal pyear As Int16)
        Dim samount As String
        Dim msgstring As String
        Dim totalamount As Int16
        If (pyear = 5) Then
            totalamount = pamount + (pyear * (pamount * 12 / 100))
            samount = Convert.ToString(totalamount)
            msgstring = pname + ":" + samount
            MsgBox(msgstring)
        ElseIf (pyear = 3) Then
            totalamount = pamount + (pyear * (pamount * 10 / 100))
            samount = Convert.ToString(totalamount)
            msgstring = pname + ":" + samount
            MsgBox(msgstring)

        ElseIf (pyear = 2) Then

            Int(totalamount = pamount + (pyear * (pamount * 8 / 100)))
            samount = Convert.ToString(totalamount)
            msgstring = pname + ":" + samount
            MsgBox(msgstring)

        Else
            MsgBox("not a valid Sheme")
        End If
    End Sub

End Class

//this is the testProgram
Imports BankComponent
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(72, 184)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(96, 56)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Button1"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(112, 112)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.TabIndex = 1
        Me.TextBox1.Text = ""
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(16, 112)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(88, 23)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "years"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 32)
        Me.Label2.Name = "Label2"
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Name"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(8, 72)
        Me.Label3.Name = "Label3"
        Me.Label3.TabIndex = 4
        Me.Label3.Text = "Amount"
        '
        'TextBox2
        '
        Me.TextBox2.Location = New System.Drawing.Point(112, 80)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.TabIndex = 5
        Me.TextBox2.Text = ""
        '
        'TextBox3
        '
        Me.TextBox3.Location = New System.Drawing.Point(112, 32)
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.TabIndex = 6
        Me.TextBox3.Text = ""
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim obj As New BankComponent.BankComponent
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim localyear As Int16
        Dim localamount As Int16
        Dim localname As String
        localyear = CInt(Me.TextBox1.Text)
        localamount = CInt(Me.TextBox2.Text)
        localname = Me.TextBox3.Text
        obj.Interest(localname, localamount, localyear)
    End Sub
End Class


 
Old November 9th, 2004, 10:15 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

How are you planning on using this component?

To use the component in a .NET project you just need to have the component in the \bin folder and have a reference to it. Usually what I do is put the binary in the root of the project (so that it's an obvious member of the project), and create a standard .NET reference to the DLL. Visual studio will automatically copy it to the \bin folder. Using a component in .NET does not require any registration process.

You mentioned COM several times... do you wish to use this .NET component in COM?
 
Old November 11th, 2004, 09:23 AM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to little_ximuoi
Default

thanks for replying.sorry about my english :D
no . I mean COM+. it's easy to use that way,just put the dll file in the bin folder.but i want to do it professionally.that's the problem

 
Old November 11th, 2004, 10:09 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I haven't worked with COM+ much.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for ASP.NET component.. subhasps8 ASP.NET 2.0 Professional 1 June 22nd, 2007 08:45 AM
.NET Component and Web Services mahesh272079 ASP.NET 1.0 and 1.1 Professional 1 February 13th, 2006 01:06 PM
.NET Component and Web Services mahesh272079 ASP.NET 1.0 and 1.1 Basics 0 February 3rd, 2006 04:16 AM
call window dialog component with asp.net/vb.net s3ng ASP.NET 1.x and 2.0 Application Design 0 June 21st, 2005 04:54 AM
What is C# Component equivalent to in VB.NET bekim C# 3 July 1st, 2004 03:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.