Hi;
I want to be able to get the names of the Runs that I create during simulation.
Is there a way to get the run names of the simulation runs?
Help
How to get the name of the Run in visual studio 2008
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: How to get the name of the Run in visual studio 2008
How are you creating the runs? If you are using a FileOpenDialog, just store the filenames returned from that.
Or if you want all .VDF files in a directory, there are plenty of free code examples on the web showing how to do that.
Or if you want all .VDF files in a directory, there are plenty of free code examples on the web showing how to do that.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: How to get the name of the Run in visual studio 2008
Hi,Administrator wrote:How are you creating the runs? If you are using a FileOpenDialog, just store the filenames returned from that.
Or if you want all .VDF files in a directory, there are plenty of free code examples on the web showing how to do that.
On my interface, I have a button which uses "vensim_command("SIMULATE>RUNNAME|? Enter a new run name") to create a new run.
I also have another button which uses "vensim_command("MENU>LOAD_RUN|?")" to load runs for simulation. I want to be able to get the names of the loaded runs during simulation.
Is there any vensim command that can be used to list or display the current loaded runs.
I could have say 5 runs created but may load 3 of them. So i will like to be able to get the names of the loaded run.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: How to get the name of the Run in visual studio 2008
ok, use the vensim_get_info function, you can get the list of loaded runs using that.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: How to get the name of the Run in visual studio 2008
Hi,Administrator wrote:ok, use the vensim_get_info function, you can get the list of loaded runs using that.
Can you help me with the use of the vensim_get_info?
When i tried the code below, a value of 22 is displayed in the textbox .
Private Sub cmdInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInfo.Click
Dim inforesult As Object
Dim bb As String
bb = "test"
inforesult = vensim_get_info(10, bb, 500)
txtInfo.Text = inforesult
End Sub
What could be wrong with the code?
Help
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: How to get the name of the Run in visual studio 2008
I'd suggest having a good look at Excel 97 example that ships with Vensim DSS. It's VBA, but the code should copy/paste to VB without many changes.
There is one function in particular,
You might also find the vensim_get_substring handy for getting the values out of the list (details of this are in the help system,http://www.vensim.com/documentation/ind ... ?26210.htm).
Be careful when passing a string to the Vensim DLL that is only 4 characters long and telling Vensim it can fill in 500 chars (bb = "test", inforesult = vensim_get_info(10, bb, 500)). It's likely to crash as Vensim will be overwriting memory that it shouldn't.
Hope this helps.
Tony.
There is one function in particular,
Code: Select all
Sub Get_Vensim_Info()
Dim buf As String * 512
result = vensim_command("SPECIAL>LOADMODEL|c:\Program Files\vensim\dll\worldapp.vpm")
vensim_command ("SIMULATE>CHGFILE|changes.cin")
vensim_command ("SIMULATE>DATA|data")
For i = 1 To 21
length = vensim_get_info(i, buf, 500)
Worksheets("Sheet1").Cells(21, 5 + i).Value = buf
Next i
End Sub
Be careful when passing a string to the Vensim DLL that is only 4 characters long and telling Vensim it can fill in 500 chars (bb = "test", inforesult = vensim_get_info(10, bb, 500)). It's likely to crash as Vensim will be overwriting memory that it shouldn't.
Hope this helps.
Tony.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559