Administration

The Novell Controls for ActiveX and Visual Basic:
Example Program

CampusblankAdminblankLibraryblankLabsblankLecturesblankTestingblankTransit Ctr
blank
PREVIOUSblankNEXT Download SourceGlossary
   

Follow the steps below to write a simple program, using the Novell Controls for ActiveX, that displays the full name of your user object in the NDS tree, the name of the NDS tree you are logged in to, and your user object's context in the tree.

1. Start Visual Basic and create a new "Standard EXE" project.

2. Select "Components" from the Project menu, scroll down the list of available components, check the box next to "Novell Directory Control" and click on the OK button.

3. Click on the Directory control's tree icon in the toolbox and add an instance of the Directory control to your project's form (see Figure 2).

Figure 2: Using the Directory Control in a Visual Basic Program.

4. Place 6 label controls on form as shown in Figure 2. Change the captions on the 3 label controls on the left side of the form to "You are:", "Logged into tree:", and "At context:" as shown in the figure. Name the three labels on the right side of the form LoginNameLbl, TreeNameLbl, and ContextLbl.

5. Double-click on the project's main form to edit the form's Form_Load subroutine. Add the following lines to the subroutine:

LoginNameLbl.Caption = NWDir1.LoginName
TreeNameLbl.Caption =  NWDir1.TreeFromFullName(NWDir1.FullName)
ContextLbl.Caption =  NWDir1.ContextFromFullName(NWDir1.FullName)

6. Change the form's caption to "Who am I?"

7. Make sure that you are logged into an NDS tree, then select "Start" from the Run Menu to execute the program.

The program displays the full name of your user object in the NDS tree, the tree name, and context. It should look something like Figure 3.

Figure 3: Who am I? example program



PREVIOUSblankTop of PageblankNEXT

    Contact Us | Feedback | License | © 2000 Novell, Inc.
Novell > DeveloperNet > Developer Support
Novell Developer Kit > DeveloperNet University