Título: paso de valores de clase a form Publicado por: ^kazike^ en 10 Marzo 2008, 11:04 am Hola: resulta que tengo el siguiente código, lo que hago es lanzar un form para que el usuario meta valores y luego pasarselos al .class pero no se porque no me coge el string.
El codigo del .class es el siguiente: Código: 'These members represent the main TestType object properties. Public RemoteAgentCLSID As String ' Run Remote Agent Class ID Public ScriptViewerCLSID As String ' ActiveX script viewer Class ID Public TestingToolName As String ' Remote Agent name Public ExecConfigCLSID As String ' Configuration Class ID Public CanCreateScriptTemplate As Long ' Flag Public LastErrorMessage As String ' Most common error message Public ResultViewerCLSID As String ' ActiveX result viewer Class ID Private td As TDConnection Dim f As New Form1 Private Sub Class_Initialize() 'This sub-routine is run when the TestType is loaded. 'Note that at this time, none of the optional controls is ' supported, as their class ID strings are empty. 'Also note that the remote agent class ID is empty, ' as no such agent yet exists. 'This example does not support script templates, ' and has only one error type. ExecConfigCLSID = "" ' No configuration utility provided RemoteAgentCLSID = "{78888EDF-6BCB-4477-AB18-9DA7D483CC52}" ScriptViewerCLSID = "{472B9CAC-C738-43BE-A0A7-EB6AB1B8BDEA}" TestingToolName = "Script" CanCreateScriptTemplate = 1 ' create new test feature turned on LastErrorMessage = "" ' Testing issues ResultViewerCLSID = "" ' No result viewer ActiveX provided LoadPicture "" nPath = "empty" closing = False End Sub Public Sub Init(mytd As Variant) ' You may need a TDConnection to use OTA functions in your application. ' If you do, add a project reference to the OTA: ' In Projects > References, check the "OTA COM 8.0 Type Library." ' and declare a module-level variable: Private td As TDConnection Set td = mytd 'Get the td object to be used if needed End Sub Public Function CreateScriptTemplate(TestKey As Long, _ ByRef LocalPath As String) As Long ' Create test script template ' this example Dim myf As String Dim path As String 'The form is loaded f.Execute path = f.getpath If closing = True Then Unload Form1 End If LocalPath = "c:\temp" myf = "C:\temp\batch.bat" Open myf For Output As #1 Print #1, "cd \ " & vbCrLf & path & vbCrLf & "pause" Print #1, "La ruta es " & path Print #1, "La ruta es " & nPath Close #1 CreateScriptTemplate = 1 End Function Private Sub Form_Unload(Cancel As Integer) 'on closing the form set the object f to point to nothing Set f = Nothing End Sub Public Function GetBitmap(Status As Long) As Long GetBitmap = 0 'no bitmap End Function Tengo tambien un archivo .bas: Código: Option Explicit 'global variable which stores the item Public nPath As String Public closing As Boolean Y el codigo del form: Código: Option Explicit Dim pathDef As String 'This method show the form Public Sub Execute() Form1.Show End Sub Private Sub Command1_Click() Dim path As String 'If Option1 button is selected If Option1.Value = True Then 'Dialog box to interact with the user and get the data Do path = InputBox("Enter the path where Nunit is installed:", "Path needed") Loop Until path <> "" pathDef = path MsgBox "Has introducido " & pathDef nPath = pathDef MsgBox "Has introducido " & nPath Command2.Enabled = True End If 'If Option2 is selected If Option2.Value = True Then 'Dialog box to interact with the user and get the data Do path = InputBox("Enter the path where you have your tests located:", "Path needed") Loop Until path <> "" pathDef = path Command2.Enabled = True End If End Sub Public Function getpath() As String 'function that gets the item selected in the drop-down box nPath = pathDef End Function Private Sub Command2_Click() closing = True End Sub Cuando lanzo el cuadro de dialogo en el form, la variable contiene el string, pero no se porque razon no crea el archivo de texto. Luego tambien me gustaria saber como se podria hacer para que cuando el form sea lanzado el otro programa quede inactivo hasta terminar la ejecucion del form Gracias y Saludos |