STATISTICA







Using STATISTICA Development Environment from within Visual Basic

Example 2: This program shows how simple it is to use the STATISTICA Development Environment from within Visual Basic to create STATISTICA data files (this example illustrates how to create a STATISTICA data file filled with random numbers).

If you would like to run this example, you may download StadevExample.zip. After unzipping this program (using WinZip or by renaming it as a self-extracting zip file, StadevExample.exe), you can run the setup program to install the StadevExample Visual Basic application. You can also open the Visual Basic project files if you have Visual Basic 5.0 loaded on your computer. Note that if you want to run this program from within Visual Basic, the stadev32.dll must be placed in either the Windows System or the Visual Basic directory so that it is visible for Visual Basic run time.


Visual Basic Code

Private Sub Command1_Click()
'create a new .sta file:
H = StaCreateFile (10, 10, "c:\newdata.sta")
If H = 0 Then Exit Sub
'change names of 3 first variables:
res = StaSetVarName (H, 1, "ABC")
res = StaSetVarName (H, 2, "MIDDLE")
res = StaSetVarName (H, 3, "XYZ")
'fill the file with random numbers:
For i = 1 To 10
	For j = 1 To 10
		res = StaSetData (H, i, j, Rnd)
	Next j
Next i
'close the .sta file
StaCloseFile (H)
msgBox "finished"
End Sub
Back to List of Programs


[StatSoft]
2300 East 14th Street, Tulsa, OK 74104
Phone: (918) 749-1119; Fax: (918) 749-2217

[StatSoft]e-mail: info@statsoft.com

©Copyright StatSoft, Inc., 1984-2005.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.