|
-
Jan 21st, 2005, 07:21 AM
#1
Thread Starter
Junior Member
[RESOLVED] Class Modules and Forms
I am trying to write a DLL and the problem that I having is that I need to get the value of a string variable from form1 of a Class Module (clGetAutomationDrives) to the Class module (clGetAutomationDrives). Can anyone tell me how to do this. This is my first exposure to Class Modules. Here is the code within the Class Module (form1):
Public Function GETDRIVES_INNTGXPFS1() As String
' THIS SUBROUTINE FINDS ALL OF THE LOGICAL DRIVES AND THEN FINDS THE
' DRIVE THAT IS NAMED AUTOMATION and is 10 characters long AND RETRIEVES THE DRIVE LETTER
Dim x, y As Integer
'Search each drive for an "Automation" indication
For x = 0 To Drive1.ListCount - 1
y = InStr(1, Drive1.List(x), "Automation", 1)
If y = 18 Then
'If found, assign the drive letter and exit the routine
GETDRIVES_INNTGXPFS1 = Mid(Drive1.List(x), 1, 1)
x = Drive1.ListCount - 1
End If
Next
'GETDRIVES_INNTGXPFS1 = MAPPEDDRIVE_INNTGXPFS1
End Function
Private Sub Form_Load()
GETDRIVES_INNTGXPFS1
End Sub
Public Property Let getdriveletter(ByVal vNewValue As String)
getdriveletter = GETDRIVES_INNTGXPFS1
End Property
Here is the code in the class module (clGetAutomationDrives):
Public MAPPEDDRIVE_INNTGXPFS1 As String
Public GETDRIVES_INNTGXPFS1 As String
Public Function loadform()
Form1.Visible = True
End Function
Public Property Get getdriveletter() As String
getdriveletter = GETDRIVES_INNTGXPFS1
End Property
Here is the code in the test form to test the DLL:
Option Explicit
Private Sub Command1_Click()
Dim test As New clGetAutomationDrives
' Create the objects
Set test = New clGetAutomationDrives
MsgBox test.loadform
Debug.Print "GETDRIVES_INNTGXPFS1="; getdriveletter
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Last edited by ga80071; Jan 21st, 2005 at 03:18 PM.
Reason: Issue resolved - Thank you very much
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|