Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.NET 2.0 error Not accessible in this context because it is Friend.

Posted on 2008-10-03
6
Medium Priority
?
3,826 Views
Last Modified: 2012-05-05
I've refferenced a VB6 OCX and I'm calling it with this code:
Imports ORDSABRE_Host

Partial Public Class _Default

    Inherits System.Web.UI.Page
    Protected WithEvents litOne As System.Web.UI.WebControls.Literal

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim SABRE As ORDSABRE_Host.Host
        SABRE = New ORDSABRE_Host.Host

        Dim varResponse As Array
        Dim X As Integer



        SABRE.Area = ""
        SABRE.ID = ""
        SABRE.Suffix = "."

        SABRE.Password = "SEP2008"
        varResponse = SABRE.Send("RES", "G*46", True)
        For X = 1 To CInt(varResponse(0))
            Debug.Print(varResponse(X))
        Next
    End Sub

End Class

I can dim the object and see its methods and properties but it asks me to set the object. When I set the object I get the 'Friend' Error. Whats up.

Chuck
0
Comment
Question by:Chuck_aa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 8

Expert Comment

by:rlh68
ID: 22642690
Does it expect you to set the property directly, may be it has a set method? Or does it have a constructor that accepts the property in question, it may bypass the friend issue.
 
0
 

Author Comment

by:Chuck_aa
ID: 22659282
I think you'll have to come down to my level. I'm not an expert in VB.net only in VB6. I have no idea what you're talking about.

Chuck_aa
0
 
LVL 8

Expert Comment

by:rlh68
ID: 22695407

I don't know anything about this OCX, but may be you cannot set the object using,

SABRE = New ORDSABRE_Host.Host

because the New routine is scoped as Friend in the OCX. If so, then may be there is a method to set or initialize the object, something like,

SABRE = ORDSABRE_Host.Host.CreateInstance

I don't know what the method's name would be. 'CreateInstance' is something I have seen used.


0
 
LVL 8

Accepted Solution

by:
rlh68 earned 2000 total points
ID: 22695415
The idea being that you cannot create the object directly, but instead you set the properties for the object and tell the object to give you an instance based on its properties.

If you are aware of design patterns then think of a Singleton pattern.
http://www.dofactory.com/Patterns/PatternSingleton.aspx

Again, I don't know what your exact issue is or if I am on the right track, but this is what I would be checking.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question