Hi all,
I got a strange problem with classes in vb.net and
hopefully someone can help me explain it.
I got a simple class project called BaseObjects, with the
following class, properties and methods
Public Class StaffBase
Private msFirstName As String
Private msLastName As String
Public Property FirstName() As String
Get
FirstName = msFirstName
End Get
Set(ByVal sFirstName As String)
msFirstName = sFirstName
End Set
End Property
Public Property LastName() As String
Get
LastName = msLastName
End Get
Set(ByVal sLastName As String)
msLastName = sLastName
End Set
End Property
End Class
Then, I created another class project called
BusinessObjects, where I added BaseObjects reference to it
Public Class Staff
Inherits BaseObjects.StaffBase
Public Sub AssignName(Byval sFirstName As String,
ByVal sLastName As String)
FirstName = sFirstName
LastName = sLastName
End Sub
End Class
Afterward, I created a new window application project as
the client (I added Staff reference to this new project)
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim oStaff As BusinessObjects.Staff
oStaff = New BusinessObjects.Staff()
oStaff.AssignName("first", "last")
MsgBox oStaff.FirstName
oStaff = Nothing
End Sub
However, when I tried to build it, I got an error saying
'Public Property FirstName() As String' is declared in
project 'BaseObjects.dll', which is not referenced by
project 'WindowsApplication1.exe'
My question is, why should I need a reference from
BaseObjects? I thought BaseObjects had been inherited to
BusinessObjects. Therefore, I only need BusinessObject's
reference.
Does anyone have a clue or explainations?
Thanks.
SC
PS: please delete the underscore to reply. 1 1431
"Swandi Candra" <_s*************@hotmail.com> schrieb Hi all,
I got a strange problem with classes in vb.net and hopefully someone can help me explain it.
I got a simple class project called BaseObjects, with the following class, properties and methods
Public Class StaffBase Private msFirstName As String Private msLastName As String
Public Property FirstName() As String Get FirstName = msFirstName End Get Set(ByVal sFirstName As String) msFirstName = sFirstName End Set End Property
Public Property LastName() As String Get LastName = msLastName End Get Set(ByVal sLastName As String) msLastName = sLastName End Set End Property End Class
Then, I created another class project called BusinessObjects, where I added BaseObjects reference to it
Public Class Staff Inherits BaseObjects.StaffBase
Public Sub AssignName(Byval sFirstName As String, ByVal sLastName As String) FirstName = sFirstName LastName = sLastName End Sub End Class
Afterward, I created a new window application project as the client (I added Staff reference to this new project)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim oStaff As BusinessObjects.Staff
oStaff = New BusinessObjects.Staff() oStaff.AssignName("first", "last") MsgBox oStaff.FirstName oStaff = Nothing End Sub
However, when I tried to build it, I got an error saying
'Public Property FirstName() As String' is declared in project 'BaseObjects.dll', which is not referenced by project 'WindowsApplication1.exe'
My question is, why should I need a reference from BaseObjects? I thought BaseObjects had been inherited to BusinessObjects. Therefore, I only need BusinessObject's reference.
Does anyone have a clue or explainations?
You also have to reference BaseObjects because it contains parts of the code
of the Staff class. In other words, the staff class is spread across two
libraries. One part is in the BaseObjects library, the other part in the
BusinessObjects library. You need both.
--
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pkpatel |
last post by:
Hi,
I keep getting this error every time I try to load
crystalreportviewer on a webform with a dataset.
Here is the error:
--------------------------------------------------------
Server...
|
by: trexim |
last post by:
Hi,
I am trying to create a Web Reference for CSTA using the URL
http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl
Visual .Net complains that:
"...
|
by: Suzanne |
last post by:
Hi all,
I'm reposting this message as I'm experiencing this problem more and
more frequently :
I really hope someone out there can help me as I've been tearing my
hair out on this one for a...
|
by: Jake Barnes |
last post by:
Using javascript closures to create singletons to ensure the survival
of a reference to an HTML block when removeChild() may remove the last
reference to the block and thus destory the block is...
|
by: Richard Lewis Haggard |
last post by:
We are having a lot of trouble with problems relating to failures relating
to 'The located assembly's manifest definition with name 'xxx' does not
match the assembly reference" but none of us here...
|
by: Michael Russell |
last post by:
Hi all,
Using C#, I've created a simple wrapper class for using Excel. I have
Office Pro 2003 installed on my devel machine. The wrapper class works
great, reading and writing to/from Excel. ...
|
by: David W |
last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like
this:
void f( int& p )
{
printf( "%d\n", p );
}
int main (int argc, char *argv)
{
|
by: toton |
last post by:
HI,
One more small doubt from today's mail.
I have certain function which returns a pointer (sometimes a const
pointer from a const member function).
And certain member function needs reference...
|
by: toton |
last post by:
Hi,
This is continuation of topic pointer & reference doubt.
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/df84ce6b9af561f9/76304d7d77f6ccca?lnk=raot#76304d7d77f6ccca
But I...
|
by: shuisheng |
last post by:
Dear All,
The problem of choosing pointer or reference is always confusing me.
Would you please give me some suggestion on it. I appreciate your kind
help.
For example, I'd like to convert a...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |