result = vensim_command("SIMULATE>RUNNAME|bobblah")
If result = 0 Then Exit Sub
num$ = Text1.Text
comstr$ = "SIMULATE>SETVAL|POPULATION INITIAL = " + num$
result = vensim_command(comstr$)
If result = 0 Then Exit Sub
result = vensim_command("MENU>RUN")
If result = 0 Then Exit Sub
To simulate the model it is useful to supply a run name. The application then reads in the initial value of population and passes that on to Vensim. The MENU>RUN command is passed to perform a simulation.
Without any visual activity from Vensim, the user can experience a long delay while simulation occurs. While it would be possible to put up a clock timer or similar object on the Visual Basic side, a better indicator of progress is helpful. The "Simulate under my control" button does this. See "VB Controlled Simulation" below.