none
value of type integer cannot be converted to string() RRS feed

  • Question

  • Hi I have below code and its throwing value of type integer cannot be converted to string(). Any help on this would be really appreciated.

    Dim m_dicStkFundInfo As New Dictionary(Of Integer, Integer) 

     Dim astrStockFundTransfer() As String

     Dim lngUBound As Integer

     Dim lngFolderRowID As Integer

     lngUBound = m_dicStkFundInfo.Item(lngFolderRowID)
            ReDim Preserve astrStockFundTransfers(lngUBound)
            astrStockFundTransfers = m_dicStkFundInfo.Item(lngFolderRowID).ToString



    • Edited by adushetty Thursday, December 20, 2018 7:44 PM missed a declaration
    Thursday, December 20, 2018 7:43 PM

Answers

  • I got answer for my problem.

    instantiate dictionary with key as integer and value as array of string.

    m_dicStkFundInfo As Dictionary(Of Integer, String())

    • Marked as answer by adushetty Friday, December 21, 2018 3:31 PM
    Friday, December 21, 2018 3:31 PM

All replies

  • Hi I have below code and its throwing value of type integer cannot be converted to string(). Any help on this would be really appreciated.

    Dim m_dicStkFundInfo As New Dictionary(Of Integer, Integer) 

     Dim astrStockFundTransfer() As String

     Dim lngUBound As Integer

     Dim lngFolderRowID As Integer

     lngUBound = m_dicStkFundInfo.Item(lngFolderRowID)
            ReDim Preserve astrStockFundTransfers(lngUBound)
            astrStockFundTransfers = m_dicStkFundInfo.Item(lngFolderRowID).ToString




    What is this supposed to do?  Can you give us some sample input and the results of that?

    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it."

    - from former MSDN User JohnWein

    SerialPort Info

    Multics - An OS ahead of its time.

    Thursday, December 20, 2018 7:58 PM
  • Please find the detailed code FYR.

    Dim m_dicStkFundInfo As New Dictionary(Of Integer, Integer) 

     Dim astrStockFundTransfers() As String

           

    Dim lngFolderRowID As Integer

    Dim lngLoopIndex As Integer
            Dim lngFolderRow As Integer
            Dim lngUBound As Integer
            Dim astrStockFundTransfers() As String
            Dim strStockFundTransfer As String
            Dim lngFndCount As Integer 'Dummy variable

     'Get the items for this and update the maintain cost dictionary
                    'before removing this item
                    ' lngUBound = UBound(m_dicStkFundInfo.Item(lngFolderRowID))
                    lngUBound = m_dicStkFundInfo.Item(lngFolderRowID)
                    ReDim Preserve astrStockFundTransfers(lngUBound)
                    astrStockFundTransfers = m_dicStkFundInfo.Item(lngFolderRowID)

                    For lngLoopIndex = CONST_ZERO To lngUBound

                        strStockFundTransfer = astrStockFundTransfers(lngLoopIndex)
                        'Update the maintain cost dictionary with these stock funds
                        UpdateMaintainCostDictionary(strStockFundTransfer, blnRemove, lngActiveRow)

                    Next lngLoopIndex

                    m_dicStkFundInfo.Remove(lngFolderRowID)

    Thursday, December 20, 2018 8:13 PM
  •  Dim astrStockFundTransfer() As String

     astrStockFundTransfers = m_dicStkFundInfo.Item(lngFolderRowID).ToString



    The code is trying to assign a string to an array.  It needs to specify an array index such as astrStockFundTransfers(0) = ...
    Thursday, December 20, 2018 8:34 PM
  • Hello,

    Please don't simply throw out code and expect us to know what you are after especially with missing parts e.g. missing variables and method.

    Here is one clue to your issue.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, December 20, 2018 8:50 PM
    Moderator
  • I got answer for my problem.

    instantiate dictionary with key as integer and value as array of string.

    m_dicStkFundInfo As Dictionary(Of Integer, String())

    • Marked as answer by adushetty Friday, December 21, 2018 3:31 PM
    Friday, December 21, 2018 3:31 PM