473,698 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Class item not accessible because it's private... but it's not?

I have a sub, and a class. The sub is like this:
Sub dothis()
Dim aInfoListX As New infoWrapperClas s
aInfoListX.para ms = ReadConfig()
Dim sqlCMD As New SqlCommand
aInfoListX.sqlC md = sqlCMD

aInfoListX.sqlC onn = New
SqlClient.SqlCo nnection(aInfoL istX.params.sql server)
End Sub

Now, I have a class, with subclasses, as below. However, in the above
sub, it tells me that "aInfoLisX.para ms.sqlserver" is not accessible in
this context because it is private". I'm using VS 2005, vb.net. I don't
quite understand what's going on here..... Any help would be greatly
appreciated!

Public Class infoWrapperClas s
Dim Item As ArrayList
Public Sub New()
Dim _Adapters As System.Manageme nt.ManagementOb jectCollection =
Nothing
Dim _AdapterInfo As
System.Manageme nt.ManagementOb jectCollection = Nothing
Dim _NdisReceiveErr ors As
System.Manageme nt.ManagementOb jectCollection = Nothing
Dim _NdisTransmitEr rors As
System.Manageme nt.ManagementOb jectCollection = Nothing
Dim _NdisMacOptions As
System.Manageme nt.ManagementOb jectCollection = Nothing
Dim _NdisLinkSpeed As
System.Manageme nt.ManagementOb jectCollection = Nothing
Dim bkGnd As New System.Componen tModel.Backgrou ndWorker
Dim wmiObj1 As New System.Manageme nt.ManagementOb ject
Dim myConfigs As New Configs

Item = New ArrayList(13)
Item.Add(_Adapt ers)
Item.Add(_Adapt erInfo)
Item.Add(_NdisR eceiveErrors)
Item.Add(_NdisT ransmitErrors)
Item.Add(_NdisM acOptions)
Item.Add(_NdisL inkSpeed)
Item.Add(bkGnd)
Item.Add(myConf igs)
Item.Add(New ServerInfo)
Item.Add(wmiObj 1)
Item.Add(New SqlClient.SqlCo mmand)
Item.Add(New nicStruct)
Item.Add(New SqlClient.SqlCo nnection)
End Sub
Public Property Adapters() As
System.Manageme nt.ManagementOb jectCollection
Get
Return CType(Item(0),
Management.Mana gementObjectCol lection)
End Get
Set(ByVal value As
System.Manageme nt.ManagementOb jectCollection)
Item(0) = value
End Set
End Property
Public Property AdapterInfo() As
System.Manageme nt.ManagementOb jectCollection
Get
Return CType(Item(1),
Management.Mana gementObjectCol lection)
End Get
Set(ByVal value As
System.Manageme nt.ManagementOb jectCollection)
Item(1) = value
End Set
End Property
Public Property NdisReceiveErro rs() As
System.Manageme nt.ManagementOb jectCollection
Get
Return CType(Item(2),
Management.Mana gementObjectCol lection)
End Get
Set(ByVal value As
System.Manageme nt.ManagementOb jectCollection)
Item(2) = value
End Set
End Property
Public Property NdisTransmitErr ors() As
System.Manageme nt.ManagementOb jectCollection
Get
Return CType(Item(3),
Management.Mana gementObjectCol lection)
End Get
Set(ByVal value As
System.Manageme nt.ManagementOb jectCollection)
Item(3) = value
End Set
End Property
Public Property NdisMacOptions( ) As
System.Manageme nt.ManagementOb jectCollection
Get
Return CType(Item(4),
Management.Mana gementObjectCol lection)
End Get
Set(ByVal value As
System.Manageme nt.ManagementOb jectCollection)
Item(4) = value
End Set
End Property
Public Property NdisLinkSpeed() As
System.Manageme nt.ManagementOb jectCollection
Get
Return CType(Item(5),
Management.Mana gementObjectCol lection)
End Get
Set(ByVal value As
System.Manageme nt.ManagementOb jectCollection)
Item(5) = value
End Set
End Property
Public Property bkgndWrkr() As
System.Componen tModel.Backgrou ndWorker
Get
Return CType(Item(6),
System.Componen tModel.Backgrou ndWorker)
End Get
Set(ByVal value As System.Componen tModel.Backgrou ndWorker)
Item(6) = value
End Set
End Property
Public Property params() As configs
Get
Return CType(Item(7), configs)
End Get
Set(ByVal value As configs)
Item(7) = value
End Set
End Property
Public Property svrInfo() As ServerInfo
Get
Return CType(Item(8), ServerInfo)
End Get
Set(ByVal value As ServerInfo)
Item(8) = value
End Set
End Property
Public Property wmiObj() As System.Manageme nt.ManagementOb ject
Get
Return CType(Item(9), Management.Mana gementObject)
End Get
Set(ByVal value As System.Manageme nt.ManagementOb ject)
Item(9) = value
End Set
End Property
Public Property sqlCmd() As SqlClient.SqlCo mmand
Get
Return CType(Item(10), SqlClient.SqlCo mmand)
End Get
Set(ByVal value As SqlClient.SqlCo mmand)
Item(10) = value
End Set
End Property
Public Property nicInfo() As nicStruct
Get
Return CType(Item(11), nicStruct)
End Get
Set(ByVal value As nicStruct)
Item(11) = value
End Set
End Property
Public Property sqlConn() As SqlClient.SqlCo nnection
Get
Return CType(Item(12), SqlClient.SqlCo nnection)
End Get
Set(ByVal value As SqlClient.SqlCo nnection)
Item(12) = value
End Set
End Property
Public Class Configs
Dim logdirectory As String
Dim logfile As String
Dim errLog As String
Dim logfileops As Boolean
Dim logscreenops As Boolean
Dim userid As String
Dim password As String
Dim ldapServer As String
Dim prodSql As String
Dim testsql As String
Dim devsql As String
Dim tempFile As String
Dim log As String
Dim sqlServer As String
End Class
Public Class ServerInfo
Dim oDN As String
Dim oGUID As Guid
Dim oDOMAIN As String
Dim ostrGUID As String
Dim oNAME As String
Dim ipAddress As String
Dim oDNSHOSTNAME As String
Dim oDescription As String
Dim oOS As String
Dim oOSVersion As String
Dim oTZ As Int16
Dim oManagedBy As String
Dim oLastLogon As Date
Dim oSPMajor As Short
Dim oSPMinor As Short
Dim oCreateDate As Date
Dim oError As Boolean
Dim oElapsed As String
Dim isPartial As Boolean
Dim isUpdate As Boolean
Dim strHosts As String
Dim DNSREAD As Boolean
End Class
Public Class nicStruct
Dim CLASSGUID As String 'The Windows CLASSGUID identifier
Dim Subkey As String 'The subkey string to find the nic
values in
Dim Value As String 'The key who's value we need
Dim PNPid As String 'The PNPSHORT adapter identifier
Dim Service As String 'The driver
Dim Duplex As String 'The duplex setting found
Dim Speed As String 'The speed found (Unless set to auto)
Dim settings As String 'The result of the registry query on
the media (speed/duplex) requested
'Dim newreturn As String '?
Dim productName As String 'i.e. "HP NC7781 GIGABIT SERVER
ADAPTER"
Dim infPath As String 'What inf is the nic using?
Dim paramSubkey As String 'The subkey to fetch the
Speed/Duplex given from "settings"
Dim bError As Boolean
Dim strIndex As String
Dim netConnectionID As String 'As viewed in the Network
connections folder
End Class
End Class

Aug 9 '06 #1
3 8723
Dim is equivalent to Private. Change them to Public

/claes

"Bmack500" <br********@gma il.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
>I have a sub, and a class. The sub is like this:
Sub dothis()
Dim aInfoListX As New infoWrapperClas s
aInfoListX.para ms = ReadConfig()
Dim sqlCMD As New SqlCommand
aInfoListX.sqlC md = sqlCMD

aInfoListX.sqlC onn = New
SqlClient.SqlCo nnection(aInfoL istX.params.sql server)
End Sub

Now, I have a class, with subclasses, as below. However, in the above
sub, it tells me that "aInfoLisX.para ms.sqlserver" is not accessible in
this context because it is private". I'm using VS 2005, vb.net. I don't
quite understand what's going on here..... Any help would be greatly
appreciated!
<deleted>
>
Public Class Configs
Dim logdirectory As String
Dim logfile As String
Dim errLog As String
Dim logfileops As Boolean
Dim logscreenops As Boolean
Dim userid As String
Dim password As String
Dim ldapServer As String
Dim prodSql As String
Dim testsql As String
Dim devsql As String
Dim tempFile As String
Dim log As String
Dim sqlServer As String
End Class
Public Class ServerInfo
Dim oDN As String
Dim oGUID As Guid
Dim oDOMAIN As String
Dim ostrGUID As String
Dim oNAME As String
Dim ipAddress As String
Dim oDNSHOSTNAME As String
Dim oDescription As String
Dim oOS As String
Dim oOSVersion As String
Dim oTZ As Int16
Dim oManagedBy As String
Dim oLastLogon As Date
Dim oSPMajor As Short
Dim oSPMinor As Short
Dim oCreateDate As Date
Dim oError As Boolean
Dim oElapsed As String
Dim isPartial As Boolean
Dim isUpdate As Boolean
Dim strHosts As String
Dim DNSREAD As Boolean
End Class
Public Class nicStruct
Dim CLASSGUID As String 'The Windows CLASSGUID identifier
Dim Subkey As String 'The subkey string to find the nic
values in
Dim Value As String 'The key who's value we need
Dim PNPid As String 'The PNPSHORT adapter identifier
Dim Service As String 'The driver
Dim Duplex As String 'The duplex setting found
Dim Speed As String 'The speed found (Unless set to auto)
Dim settings As String 'The result of the registry query on
the media (speed/duplex) requested
'Dim newreturn As String '?
Dim productName As String 'i.e. "HP NC7781 GIGABIT SERVER
ADAPTER"
Dim infPath As String 'What inf is the nic using?
Dim paramSubkey As String 'The subkey to fetch the
Speed/Duplex given from "settings"
Dim bError As Boolean
Dim strIndex As String
Dim netConnectionID As String 'As viewed in the Network
connections folder
End Class
End Class

Aug 9 '06 #2
Bmack500 wrote:
Sub dothis()
Dim aInfoListX As New infoWrapperClas s
.. . .
aInfoListX.sqlC onn = New
SqlClient.SqlCo nnection(aInfoL istX.params.sql server)
End Sub

it tells me that "aInfoLisX.para ms.sqlserver" is not accessible in
this context because it is private". I'm using VS 2005, vb.net.
Boiling down your code to the relevant bits ...
Public Class infoWrapperClas s
.. . .
Public Property params() As configs
Get
Return CType(Item(7), configs)
End Get
.. . .
Public Class Configs
.. . .
Dim sqlServer As String
I suspect that "Dim" (within a Class) is equivalent to "Private" and not
to "Public", as you are assuming.

Except within a method, where you have no choice, abandon Dim to the
Past and use the "modern" Access Specifiers.

HTH,
Phill W.
Aug 9 '06 #3
Ahhh, sometimes being new at something with no formal training
sucks.... gotta go read some more!!!

Thank you very much.

Phill W. wrote:
Bmack500 wrote:
Sub dothis()
Dim aInfoListX As New infoWrapperClas s
. . .
aInfoListX.sqlC onn = New
SqlClient.SqlCo nnection(aInfoL istX.params.sql server)
End Sub

it tells me that "aInfoLisX.para ms.sqlserver" is not accessible in
this context because it is private". I'm using VS 2005, vb.net.

Boiling down your code to the relevant bits ...
Public Class infoWrapperClas s
. . .
Public Property params() As configs
Get
Return CType(Item(7), configs)
End Get
. . .
Public Class Configs
. . .
Dim sqlServer As String

I suspect that "Dim" (within a Class) is equivalent to "Private" and not
to "Public", as you are assuming.

Except within a method, where you have no choice, abandon Dim to the
Past and use the "modern" Access Specifiers.

HTH,
Phill W.
Aug 9 '06 #4

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

Similar topics

6
1788
by: F. Petitjean | last post by:
I want to know if iter(iterator) returns always its argument (when argument is an iterator) So : >>> iterable = range(10) >>> it = iter(iterable) >>> that = iter(it) >>> that is it True # Good! >>> that is it is not it
7
4309
by: Dan V. | last post by:
Still struggling with css. Anyone know how to put a tope background colour (matches the right part of the banner image) that stretches to the max. size of the window like the main div? My header has a big black 'box' at the top right. I would like to keep black as the main background colour of the header div though. Unless someone knows another way to make my header look good. Please see: http://officeactivate.com/schuit/
0
336
by: Tom L | last post by:
I have a vb.net app that I created a setup for. I can install it and run it just fine on my XP box, but I'm having problems ont he NT4 workstation box. the nt4 box has sp6a, the .net 1.1 clr, and also mdac 2.8. the installation goes through fine, not one warning or error. When I run the program exe, I get this error: "myprogram.exe - Common Language Runtime Debugging Servi..." Application has generate an expcetion that could not be...
22
2175
by: john bailo | last post by:
oh man, i've been working all month on c# and now I get a java project. finally. life is great !!! -- http://www.museum.tv/ETV/G/htmlG/greenacres/greenacres.htm
7
4983
by: Bill | last post by:
Hello, Here is some code: I'm thinking that when storing an object in an ArrayList or Hashtable that it clones the object. This can be shown like so: // key is a generated hashcode for this function (its unique). public struct Test {
4
2877
by: Jack Wright | last post by:
Dear All, I would like to read the processModel from machine.config. The following is code I have writte Dim hConfig As Object = ConfigurationSettings.GetConfig("system.web/processModel") But if I try to typecast hConfig with System.Web.Configuration.ProcessModelConfig I get the following error: 'System.Web.Configuration.ProcessModelConfig' is not accessible in this context because it is 'Private'.
1
2756
by: Richard | last post by:
I keep getting this error and i dont know how 2 fix it. If someone knows how, please tell me :D Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30389: 'C' is not accessible in this context because it is 'Private'.
0
1042
by: Bmack500 | last post by:
I'm getting an error when I try to access the properties in oResult, stating: "System.DirectoryServices.SearchResultCollection.Properties is not accessible in this context because it is 'private'". I don't understand why, since I've passed it as a parameter to the sub. Thanks in advance for any help. Here's the entire (unfinished) sub: Sub insertADRecords(ByVal strCurrOU As String, ByVal oResult As SearchResultCollection) Dim iIndex1...
1
978
by: user | last post by:
Hello, With asp.net 2, i have a detailsview and a dropdownlist : I have create a databound event with the detailsview that take a value in the detailsview (with Data.DataRowView) to select a default item in the dropdownlist.... And it works.... is it the right way ? i was thinking i should do it with the load page event .. Will the dropdownlist be always databound before the detailsview ? Some explications please ...
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7739
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5862
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.