Page 1 of 1

How to get the List of dataset loaded for simulation

Posted: Thu Mar 21, 2013 10:42 am
by Paul Anim
Hi All,
I am using MENU>LOAD_RUN|? in a vb.net program to open the dialog box to load the datasets.
Below is the sample Vb.net code I used

Code: Select all

 Dim result As Object
 result = vensim_command("MENU>LOAD_RUN|?")
I want to know how to get the (names or counts)of the list of loaded datasets for the simulation.
Thanks

Re: How to get the List of dataset loaded for simulation

Posted: Thu Mar 21, 2013 11:01 am
by Administrator

Re: How to get the List of dataset loaded for simulation

Posted: Thu Mar 21, 2013 1:34 pm
by Paul Anim
Thanks very much.
I am having a difficulty on how to call the vensim_get_info function especially on how to supply the variable(s) to the function.
Below is my sample code

Code: Select all

Dim testresult As Object
        Dim testbuf As String = ""

        testresult = vensim_get_info(10, testbuf, 500)

Re: How to get the List of dataset loaded for simulation

Posted: Thu Mar 21, 2013 2:05 pm
by Administrator
Try the following. The string you are passing to Vensim was zero length ("") but you are telling Vensim that it is 500 chars long.

Code: Select all

Public Declare Function vensim_get_info Lib "vendll32.dll" (ByVal infowanted As Short, ByVal buf$, ByVal maxbuflen As Short) As Short

Code: Select all

        Dim nMaxStringLen As Long
        nMaxStringLen = 500

        Dim sBuffer As String
        sBuffer = New String(" ", nMaxStringLen)

        nResult = vensim_get_info(10, sBuffer, nMaxStringLen)

Re: How to get the List of dataset loaded for simulation

Posted: Thu Mar 21, 2013 2:38 pm
by Paul Anim
thanks alot for your help