Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Visual Basic
  3. variable problems

variable problems

Scheduled Pinned Locked Moved Visual Basic
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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

    R L 2 Replies Last reply
    0
    • L Lost User

      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

      R Offline
      R Offline
      Raveendra Madupu
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • L Lost User

        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

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups