Results 1 to 2 of 2

Thread: OOP Lockout?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382

    OOP Lockout?

    Does the OOP in VB.Net differ from other OOP languages? It seems the encapsulation rules placed on vb.net are more stringent than other languages. In delphi, I can access the base application "form class" from any class just by referencing the class itself and anything public within it. Seems that no matter what I do in VB, accessing controls on a form from a Class is nearly impossible without using an event.

    Can anyone give me a simple example of how to say Update the caption on a label in Form1 from Class1 "without" the use of a event?

    I was reading through the forums for ways to do this and I read that you should just add a public property to the Form1 class so I tried that but it doesn't work. All your Public methods and propertys aren't accessable by just trying Form1.MyMethod like it should be..

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Your going to have to pass in a reference of the form object instance to the class in order to modify it's members.

    So you need to pass of reference of the form1 to the class1 somehow, either through properties, constructor, or through a method call. Your control that you want to manipulate may also have to be public or friend in order for it to work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width