473,412 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Can't use New?

Hello all,

I added an ocx file (a VB6 usercontrol that I made) as a reference in my
vb.net project. However, when I try to instantiate a new copy of the
control class with the following line:

Private m_hpib As New HPIB

I get this error:

'C:\MyProjects\Antenna Test Range Control\Antenna Test Range
Control\modHPIB.vb(5): 'IoTechHPIBControl.HPIBClass.Private Sub New()'
is not accessible in this context because it is 'Private'.

How can I create an instance of th class if I can't use the "New" keyword??

-Joel
Nov 21 '05 #1
5 942
since the ctor is marked private, you really have no options -- are
there any public constructors? also, is there another object that
returns this type of object?

Nov 21 '05 #2
stand__sure wrote:
since the ctor is marked private, you really have no options -- are
there any public constructors? also, is there another object that
returns this type of object?


No other objects return this kind of object. I'm not sure if there are
any public constructors, but if there were, wouldn't the New keyword
specify them by default?

-Joel

Nov 21 '05 #3


Joel Whitehouse wrote:
stand__sure wrote:
since the ctor is marked private, you really have no options -- are
there any public constructors? also, is there another object that
returns this type of object?


No other objects return this kind of object. I'm not sure if there are
any public constructors, but if there were, wouldn't the New keyword
specify them by default?


When you say eg

Dim myX As New X

, you are saying you want to use that constructor of X that takes no
parameters. For this particular class, that constructor is marked
Private, so you can't use it. It may happen that the class has other
constructors - for example, it might have a

Public Sub New(s As String)

in which case you would be allowed to create one with

Dim myX As New X("some string")

The compiles works out which constructor to use by looking at the
arguments you supply, just as with any over overloaded procedure.

In this case since you say it is authored by you, you just need to
check you have set the accessors on your constructors correctly.

--
Larry Lard
Replies to group please

Nov 21 '05 #4
Larry Lard wrote:
in which case you would be allowed to create one with

Dim myX As New X("some string")


Thanks - I'll look into this. That's a handy thing to know!

-Joel
Nov 21 '05 #5
Larry Lard wrote:
In this case since you say it is authored by you, you just need to
check you have set the accessors on your constructors correctly.


Well see, it's authored by me, but since I wrote it in VB6, I can't use
the New keyword as the name for a sub routine. Is there any other way
that I can make a public constructor through VB?

-Joel
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: farzad | last post by:
Hi I try to install php_ming.so in my php . I am using Redhat 8.0 php 4.2.2 apache 2.0.4. I am doing as the howto install file want me to do. as follow....
7
by: Adams-Blake Co. | last post by:
This may be OT a bit, so maybe someone can point me in the right direction. I want to test a script that sends out an e-mail. I want to test it locally on my Mandrake Linux 8.2 box. It runs OK...
3
by: lawrence | last post by:
I haven't been able to reach www.php.net for days. Most of the rest of the web is working for me, though I've bad trouble reaching any English sites. Anyone else having trouble?
6
by: Michel | last post by:
Hi, I like to build a small simple dinamic website: Point-of-sale (detail-shop), So entering stock, logging all sales, print out invoices and download the logs to be imported into Excel. I...
3
by: nadia | last post by:
Is it possible to do the following in php: I want to have a main form open. In the form I want a button that will open a popup window so the user can search for something. The user can then select...
6
by: lawrence | last post by:
How dangerous or stupid is it for an object to have a reference to the object which contains it? If I have a class called $controllerForAll which has an arrray of all the objects that exist, what...
5
by: Alper Adatoz | last post by:
Hi, i have a little problem. i hope u guys give me a clear solution (: db: mssql i just want to put jpeg file to the image field at the mssql db. and after that i want to call it back..
2
by: Sam Hou | last post by:
Dear all, I don't know where my problem is. Hopefully someone can give me some hint to explore the problem more. I am running Apache 2.0.48 wih PHP 4.3.4. The apache is running as nobody. I...
14
by: NotGiven | last post by:
I am guessing I would hold a variable of when it's opened, then in the script that runs when the page is offloaded, I coudl calcualte it. How do you store a time variable? How do you calculate...
4
by: Ryan Hubbard | last post by:
I would like to limit multiple logins for a user. How and when does the session id expire? Can I set it so after x minutes of inactivity it would expire. How do I check if session id exists? If...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.