Administrator wrote:
So is vensim_get_data working for you? The C++ example that ships with Vensim uses it to get data from runs, have you tried compiling and running that?
Hi,
I am having a problem with the vesnim_get_data. I am not into C++ but rather VB. So i compiled the vb example that was shipped with vensim. since i am using vb.net 2008, and the example seems to be in vb5 or so. I used vb2008 to upgrade the code and I was able to compile the example in vb2008. Most of the features on the example works except the get data button(which runs vensim_get_data command) and the plot command.
What i want to do is to be able to display output of the vensim_get_data command. I want output the vensim_get_data to grid control in vb2008
this is the code for the get data button
Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
tpoints = vensim_get_data("base.vdf", "population", "time", rval(1), tval(1), 500)
tpoints = vensim_get_data("bobblah.vdf", "population", "time", rval2(1), tval(1), 500)
End Sub
This is also the code for the Plot graph button
Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command3.Click
Dim i As Integer
Dim NumPoints As Integer
Dim NumSets As Integer
Dim ThisSet As Integer
Dim ThisPoint As Integer
Dim GraphData As Integer
If tpoints = 0 Then Exit Sub
'UPGRADE_ISSUE: PictureBox property Graph1.DrawMode was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
'Graph1.DrawMode = 0
'Graph1.DrawMode = 0
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.NumPoints. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
NumPoints = tpoints
NumSets = 2
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisSet. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisSet = 1
For i = 1 To tpoints
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisPoint. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisPoint = i
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.GraphData. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
GraphData = rval(i)
Next i
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisSet. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisSet = 2
For i = 1 To tpoints
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.ThisPoint. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ThisPoint = i
'UPGRADE_WARNING: Couldn't resolve default property of object Graph1.GraphData. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
GraphData = rval2(i)
Next i
'UPGRADE_ISSUE: PictureBox property Graph1.DrawMode was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
'Graph1.DrawMode = 2
End Sub
Private Sub Command4_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
Dim result As Object
Dim winint As Integer
winint = Me.Picture1.Handle.ToInt32
'UPGRADE_WARNING: Couldn't resolve default property of object result. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
result = vensim_tool_command("WORKBENCH>Causes Tree", winint, 0)
End Sub
Thanks