variable problems
-
I have a Variable Problem, that is being fill but I can't read it I'm sending the variable to a DLL which is declared; Private Declare Function GetList Lib "C:\Program Files\Microsoft Visual Studio\MyProjects\API\Debug\API.dll" _ (ByVal pszSch As String, ByVal pszQualifier As String, vNumber As Variant, ByVal pszMessage As String) As Long The Function that calls this DLL is; Private Sub Command1_Click() Dim xStatus As Integer Dim pszSch As String Dim pszMessage As String Dim pszQualifier As String Dim vNumber As Variant ReDim vNumber(2002) As String pszSch = "TEST" pszQualifier = " 'COM_NUM' = 123" pszMessage = Space$(255) xStatus = GetList(pszSch, pszQualifier, vNumber, pszMessage) MsgBox vNumber(x), vbInformation, "vNumber" Text1 = vNumber(x) The MsgBox line with the vNumber will display the value in the variable But the Text1 line shows nothing for the variable What do I do to read this variable without the message box ? thanks
-
I have a Variable Problem, that is being fill but I can't read it I'm sending the variable to a DLL which is declared; Private Declare Function GetList Lib "C:\Program Files\Microsoft Visual Studio\MyProjects\API\Debug\API.dll" _ (ByVal pszSch As String, ByVal pszQualifier As String, vNumber As Variant, ByVal pszMessage As String) As Long The Function that calls this DLL is; Private Sub Command1_Click() Dim xStatus As Integer Dim pszSch As String Dim pszMessage As String Dim pszQualifier As String Dim vNumber As Variant ReDim vNumber(2002) As String pszSch = "TEST" pszQualifier = " 'COM_NUM' = 123" pszMessage = Space$(255) xStatus = GetList(pszSch, pszQualifier, vNumber, pszMessage) MsgBox vNumber(x), vbInformation, "vNumber" Text1 = vNumber(x) The MsgBox line with the vNumber will display the value in the variable But the Text1 line shows nothing for the variable What do I do to read this variable without the message box ? thanks
I hope that this will work Text1.Text = trim(cstr(vNumber(x))) since the return variable is Variant type, before getting its value to the text box convert it into text type. Raveendra Madupu Member Technical Staff Network Programs India Limited raveendra@engineer.com
-
I have a Variable Problem, that is being fill but I can't read it I'm sending the variable to a DLL which is declared; Private Declare Function GetList Lib "C:\Program Files\Microsoft Visual Studio\MyProjects\API\Debug\API.dll" _ (ByVal pszSch As String, ByVal pszQualifier As String, vNumber As Variant, ByVal pszMessage As String) As Long The Function that calls this DLL is; Private Sub Command1_Click() Dim xStatus As Integer Dim pszSch As String Dim pszMessage As String Dim pszQualifier As String Dim vNumber As Variant ReDim vNumber(2002) As String pszSch = "TEST" pszQualifier = " 'COM_NUM' = 123" pszMessage = Space$(255) xStatus = GetList(pszSch, pszQualifier, vNumber, pszMessage) MsgBox vNumber(x), vbInformation, "vNumber" Text1 = vNumber(x) The MsgBox line with the vNumber will display the value in the variable But the Text1 line shows nothing for the variable What do I do to read this variable without the message box ? thanks
I would say that if vNumber should be a numerical value, explicitly cast it to what you need it to be. It is probably turning into a string. Set a breakpoint at the MsgBox line and set a watch on vNumber(x). That will probably help you determine how the data is kept and what you need to do with it. Text1.Text = CInt( vNumber( x ) ) By the way, is x declared elsewhere?