Click here to Skip to main content
15,908,172 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: About API call Pin
Nanda_MR14-Dec-08 22:29
Nanda_MR14-Dec-08 22:29 
GeneralRe: About API call Pin
Christian Graus14-Dec-08 22:55
protectorChristian Graus14-Dec-08 22:55 
GeneralRe: About API call Pin
dan!sh 14-Dec-08 23:35
professional dan!sh 14-Dec-08 23:35 
GeneralRe: About API call Pin
Christian Graus15-Dec-08 10:09
protectorChristian Graus15-Dec-08 10:09 
GeneralRe: About API call Pin
Colin Angus Mackay14-Dec-08 23:10
Colin Angus Mackay14-Dec-08 23:10 
GeneralRe: About API call Pin
Christian Graus15-Dec-08 10:10
protectorChristian Graus15-Dec-08 10:10 
GeneralRe: About API call Pin
Luc Pattyn15-Dec-08 1:29
sitebuilderLuc Pattyn15-Dec-08 1:29 
QuestionAPI call from VB.net Pin
hribek2514-Dec-08 21:37
hribek2514-Dec-08 21:37 
Hello,
I am struggling with API calls from VB.net. Basically, it is fine but a problem occurs when I try to call API which needs arrays to be passed.

API specification:
Public Declare Function spssGetVarNValueLabels Lib "spssio32.dll" Alias "spssGetVarNValueLabels@20" (ByVal handle As Integer, ByVal varName As String, ByRef values() As Double, ByVal labels() As String, ByRef numofLabels As Integer) As Integer

VB.NET call:
Dim handle As Integer = 0
Dim varname As String = "subject"
Dim numvallabs As Integer
Dim values(10) As Double
Dim labels(10) As String

erro = spssGetVarNValueLabels(handle, varname, values, labels, numvallabs)

No problems: handle, varname, numvallabs. In addition, I get correct value via "numvallabs".
But routine should return two arrays via values (double) and labels (string) and this is the problem. I have tried other similar API calls (integers or strings only) and everything was fine. But arrays are pain.

Since I read some topics how bridge the differences between C and VB, I have also tried to replace string variable for byte() or pass only the first element of array - but nothing helped. Current version return first element of doubled-array and nothing for string-array.

Full working code is enclosed: http://dev.zizkovi.name/anxiety.zip

Many thanks for any help in advance.

Petr
P.S. Background info: sav file is binary file used by SPSS Application. This DLL library is designated to read those files, etc.

Here is the sample code of mentioned call in C++ - published by vendor of used API:
#include <stdio.h>
#include "spssdio.h"
void func()
{
int fH; /* file handle */
int error; /* error code */
int numL; /* number of values or labels */
double *nValuesL; /* values */
char **labelsL; /* labels */
...
error = spssOpenRead("bank.sav", &fH);
...
/* Get and print value labels for numeric variable SEX */
error = spssGetVarNValueLabels(fH, "SEX",
&nValuesL, &labelsL, &numL);
if (error == SPSS_OK)
{
int i;
printf("Value labels for SEX\n");
for (i = 0; i < numL; ++i)
{
printf("Value: %g, Label: %s\n", valuesL[i], labelsL[i]);
}
/* Free the values & labels */
spssFreeVarNValueLabels(nValuesL, labelsL, numL);
}
}</stdio.h>

AnswerRe: API call from VB.net Pin
Ben Fair15-Dec-08 2:02
Ben Fair15-Dec-08 2:02 
AnswerRe: API call from VB.net Pin
Thomas Stockwell17-Dec-08 5:39
professionalThomas Stockwell17-Dec-08 5:39 
QuestionConvert HTML into RTF Pin
JR21214-Dec-08 21:22
JR21214-Dec-08 21:22 
AnswerRe: Convert HTML into RTF Pin
Christian Graus14-Dec-08 21:49
protectorChristian Graus14-Dec-08 21:49 
GeneralRe: Convert HTML into RTF Pin
JR21214-Dec-08 23:11
JR21214-Dec-08 23:11 
GeneralRe: Convert HTML into RTF Pin
Dave Kreskowiak15-Dec-08 4:20
mveDave Kreskowiak15-Dec-08 4:20 
QuestionCalling webservice with forms authentication Pin
AlexeiXX314-Dec-08 16:25
AlexeiXX314-Dec-08 16:25 
Questionsend email Pin
angels77714-Dec-08 2:33
angels77714-Dec-08 2:33 
AnswerRe: send email Pin
Colin Angus Mackay14-Dec-08 4:20
Colin Angus Mackay14-Dec-08 4:20 
AnswerRe: send email Pin
LloydA11114-Dec-08 6:55
LloydA11114-Dec-08 6:55 
AnswerRe: send email Pin
Christian Graus14-Dec-08 8:29
protectorChristian Graus14-Dec-08 8:29 
GeneralRe: send email Pin
astanton197815-Dec-08 8:08
astanton197815-Dec-08 8:08 
Questionsend email Pin
angels77714-Dec-08 2:19
angels77714-Dec-08 2:19 
AnswerRe: send email Pin
Christian Graus14-Dec-08 8:29
protectorChristian Graus14-Dec-08 8:29 
AnswerRe: send email Pin
Charl14-Dec-08 20:57
Charl14-Dec-08 20:57 
QuestionEnable/Disable Modem Pin
Member 216783614-Dec-08 1:53
Member 216783614-Dec-08 1:53 
Question[Message Deleted] Pin
njote13-Dec-08 19:36
njote13-Dec-08 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.