Method with parameters

Hi, please I need help.
I have window1 and window2, and I want return 2 parameters from window2 to window1, the code in window2 is like this :
//Method
Function ShowModal(IDRespIDCarg As Integer) As Integer()
dim resIDRes,resIDCar As integer
resIDRes = 2
resIDCar = 3

return (?)
End Function

-Question : Is it possible to send in return function 2 values, resIDRes and resIDCar ?
Thanks for any help.

This Is the code in window1 to for window2 to return the 2 parameters :

dim resIDRes, ResIDCar As Integer
wResponsabilidad_Add.ShowModal(resIDRes, ResIDCar)

MsgBox Str(resIDRes)
MsgBox Str(resIDRes)

There are many way to do this but returning values from a Show is not the way. Probably the easiest is to declare a set of global variables or public variables in window1 properties and set their values from window2 just before closing window2. Then window1 can grab the values from there.

There are, of course other, possibly cleaner way but this is the simplest that I know of.

[quote=131566:@Dale Arends]There are many way to do this but returning values from a Show is not the way. Probably the easiest is to declare a set of global variables or public variables in window1 properties and set their values from window2 just before closing window2. Then window1 can grab the values from there.

There are, of course other, possibly cleaner way but this is the simplest that I know of.[/quote]

Global variables are the way. I tried with window public variables, and they are not set yet when the window open event occurs. Besides, setting a window variable with implicit instance will in effect show the window.

Make a Class with those 2 parameters.
Make an Instance from this Class.
Fill the parameters.
Return the Instance.

Pass the variables ByRef.

First for all, thanks Michel, Dale and Stefan for your reply.
Please, If I understand, my code Is not the best way to make return 2 values from parameters in window2 to window1 ?
Sory, and have patience with me, I’am not english man , can you put example code or improve my code for retur 2 values from windos2?

Thanks also Tim, my problem Is If I want return 2 values in window2( Return IDResp, IDCarg) this generates runtime error.
Sory my first post was not exact, this is OK :
//function receives 2 parameters
Function ShowModal(IDResp,IDCarg As Integer) As Integer()
//I apply a value to the 2 variables
IDResp = 2
IDCarg = 3
//I want return 2 different values
return (IDResp, IDCarg)
End Function

I hope this is right…

Do not misunderstand me , I will try to use the recommendations they made me.
I just want to know if the code I 've written would be feasible or not, and if correct.

Try

Sub ShowModal(ByRef IDResp as Integer, ByRef IDCarg as Integer)
   IDResp = 2
   IDCarg = 3
End Sub
dim a, b as Integer
ShowModal(a, b)
// a = 2, b = 3

Hi Tim, thanks very mach for this example.
I have try your code and works fine, thanks very mach for your help and equally to Michel, Stefan and Dale.
I’ts cool to have people that help you quickly and efficiently, thanks all and good night(or day)