|
-
Jun 25th, 2000, 05:57 AM
#1
Thread Starter
New Member
I need to build an application that receive a parámeter like a option that return data. How i declare this parameter in the first form or module and the variable returned ?
-
Jun 25th, 2000, 08:23 AM
#2
PowerPoster
???
Can not get what you mean.
-
Jun 25th, 2000, 08:25 AM
#3
Hyperactive Member
Huh
Explain your problem, and I may be able to help you.
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 25th, 2000, 10:14 AM
#4
Lively Member
If you mean you want to save a setting when you finish with the programme, and retrieve it later, you can use the commands GetSetting and SaveSetting. These use the registry to save any setting you want and retrieve it later.
Say you have a text box called Text1, and you want it to 'remember' what it said the last time the user ran the programme, you would put in the Form_Unload event
Code:
SaveSetting("MyApp","Startup","Text",Text1.text)
and in the Form_Load event,
Code:
Text1.text=GetSetting("MyApp","Startup","Text","")
-
Jun 26th, 2000, 04:57 AM
#5
Thread Starter
New Member
Excuse my poor description of problem.
I want to build an application that receive data from command line and return data to command line, i.e.
"myapp.exe parameter", and return code of execution (success or no).
-
Jun 26th, 2000, 05:10 AM
#6
Lively Member
To retrieve data from the command line, you use the Command$ operator in the form_load event.
Code:
Msgbox "You said " & Command$
I don't know how to return data to the command-line.
-
Jun 26th, 2000, 01:36 PM
#7
PowerPoster
Should be under the Form_Load() Events
You should get the command line paramter when your program is started and not at the mid way of your program.
Code:
'Declare under Basic Module File
Option Explicit
Public MyCommandLine As String
Private Sub Form_Load()
MyCommandLine = Command()
'Assume your program will only loaded when the command line string is /%2
If MyCommandLine <> "/%2" then End
End Sub
or if your program is start from a Sub main module.
Code:
Option Explicit
Public MyCommandLine As String
Public Sub Main ()
MyCommandLine = Command()
'Assume your program will only loaded when the command line string is /%2
If MyCommandLine <> "/%2" then
End
Else
Load frmMain
frmMain.Show
End If
End Sub
-
Jun 26th, 2000, 02:06 PM
#8
Addicted Member
Retrieving parameters from the commandline has been answered already.
I don't think you can return a value from a VB prog other than putting some file on disk or write a value to the registry.
If I'm wrong I would like to know, cause I've always considered this an omission in VB.
Regards,
Laurens
Using VB5 Enterprise edition SP3
VB6 Enterprise edition SP5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|