Passing Arguements

Hi,

What i am looking to do, and i am not sure how i go about doin it.
I am working with someone else in a project, and he is doin one side and i am doin the other. What is going to happen, is that he is going to pass me a value (integer value), and now i have to capture this value and carry on with my criteria.
Now how do i set up an arguement as such?
Where an integer value is passed and i capture it?

Hope you understand what i need

Thanks!
mscalaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
LewyConnect With a Mentor Commented:
Try:

SqlWriteHeader = "Select * from tblBDBBatchHeader where BatchNo like '" & Format(yourVariable,"#") & "'"

This will put yourVariable value as an integer in the SqlWriteHeader string.
0
 
twardCommented:
Are you going to be writing just a function that he passes a value to?

Are you writing a seperate .EXE that will be passed a variable?

MYEEXE.EXE VariableToUse

In your Program look at Command Method of VB.
0
 
crazymanCommented:
When you say pass you a value do you mean from one exe to another or is it in the same code like into a function?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
deightonCommented:
Is it all within a single VB project?

If so then he makes a .bas module with a public variable in it which you can both access.  Or you can make a function where he passes you the value as an argument by calling it.

public function interface(iArg as integer) as integer

'code
..
..
'receives an integer and passes back an integer'


end function

'perhpas need an overview of what you are doing

0
 
mscalaAuthor Commented:
Yes, i am writing a seperate exe, that will be passed a variable.
0
 
crazymanCommented:
when you run your exe you can send it parameters like

shell "MyApp.exe hello test"

this would be interpretated by the activated exe using the command method.

strArgs = Command()
in this example strArgs would equal "hello test"
0
 
crazymanCommented:
myApp.exe of course should be a full path to your app
0
 
deightonCommented:
If you call one .exe from the other then use

dim sCall as string
dim yourInt as integer

sCall = "second.exe " & cstr(YourInt)

shell sCall

..

then in the second .exe use

dim iIntVal as integer

iIntVal = cint(command$)



If both are running concurrently and you want to swap values, then you can write to a simple file in one app then poll it in the other, but check for file errors e.g locking.
0
 
crazymanCommented:
Of course this only passes info on start up of the app if you want to pass data to an already running app there are various methods some easier than others.
0
 
crazymanCommented:
Passing paramters you could also use simple registry instead of files.
eg

savesetting "Projectname","Settings","newVal",value


then poll it from the other app

retVal=cint(getsetting("Projectname","Settings","newval")
0
 
crazymanCommented:
i think i missed this out

)
0
 
3rsrichardCommented:
You could use the 'command' system
(See VB help files)
---------------------------------------
For example, suppose you create an alarm clock application. One of the techniques for setting the alarm time is to let the user type in the selected time directly. The user might enter the following string in the Run dialog box:

Alarm 11:00:00

The Command function returns all arguments entered after the application name (in this case, Alarm). The Alarm application has only one argument, so in the application code, you can assign this argument directly to the string that stores the selected time:

AlarmTime = Command

If Command returns an empty string, there are no command-line arguments. The application must either ask for the information directly or select a default action.

0
 
LewyCommented:
Tell us more about what you and the other guy are doing. What kind of project is it? How often does the value get passed? Is it just once or is it passed many times? Are the two programs running at the same time? Are you fimilar with DDE?
0
 
catco01Commented:
Tell us more about what you are doing. Your program always is call with the other guy .exe?
0
 
mscalaAuthor Commented:
This a part of the code i am using, but illistrates what i need.

Dim SQLDB As New ADODB.Connection
Dim EliteDB As New ADODB.Connection

Dim RsWriteHeader As New ADODB.Recordset
Dim SqlWriteHeader As String

SQLDB.Open "Provider=SQLOLEDB.1;Persist Security Info=False;" _
   & "User ID=" & "Michael" & ";Password=" & "Michael" & ";" _
   & "Initial Catalog=BDBMaster;Data Source=SqlServer"
   
EliteDB.Open "Provider=MSDASQL.1;Persist Security Info=False;" _
 & "User ID=Michael;Data Source=Paradox;Initial Catalog=c:\WINELITE\DATA\LIVE"

SqlWriteHeader = "Select * from tblBDBBatchHeader where BatchNo like '2'"
RsWriteHeader.Open SqlWriteHeader, SQLDB, adOpenStatic, adLockOptimistic, adCmdText

RsWriteHeader("BatchStatus") = "C"
RsWriteHeader.Update

RsWriteHeader.Close

Basically in my sql statement, where i say :  Where BatchNo like '2', this 2 is hardcoded, and basially that number will be passed a variable.
0
 
mscalaAuthor Commented:
Didn't answer anything
0
All Courses

From novice to tech pro — start learning today.