Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. How to instantiate an .net object with parameterized constructor in VB6?

How to instantiate an .net object with parameterized constructor in VB6?

Scheduled Pinned Locked Moved COM
helpquestioncsharpcom
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saranya B
    wrote on last edited by
    #1

    Hello everybody, I hope someone can help me... My .net code goes like this...

    public class ProxyFacade : BaseProxyFacade

    {

    ProxyConfiguration _configuration = new ProxyConfiguration();

    public ProxyFacade(Uri Uri)

    {

    _configuration.Url = Uri;

    }

    public Student IncreaseAge(Student StudObj)

    {

    StudentServiceClient client;

    base.ProxyConfiguration = _configuration;

    base.PreProceedHandler();

    client = new StudentServiceClient(base.BaseProxy, base.BaseProxy.EndPointAddress);

    client.Open();

    return client.IncreaseAge(StudObj);

    }

    }

    My Issue: I have registered this dll as COM component. When I try to instantiate this ProxyFacade from VB6, I am not able to give the object reference with New Keyword? Do I have to set anything in the .net side? What is the correct way to instantiate this .net object registered as COM? My VB6 code:

    Private Sub cmd_CallCOM_Click()
    Dim objStud As New ProxyLibrary.Student
    Dim a As Integer
    objStud.Age = 11
    objStud.Name = "Johnie"
    objStud.IsOutStanding = False
    Dim objFacade As ProxyLibrary.StudentServiceClient
    Dim b As ProxyFacade

    'a = objFacade.IncreaseAge()
    'Set objFacade = GetObject("http://localhost:3507/StudentException/Student Service.svc/rest")
    lbl_Age.Caption = objFacade.IncreaseAge(objStud).Age
    End Sub

    When i tried with GetObject, again error... I think i am taking a wrong way to instantiate this object which has parameterized constructor... Any help plssssssssss Tnx in advance, Saran

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups