 |
| View previous topic :: View next topic |
| Author |
Message |
deepod Newbie
Joined: 15 Jun 2005 Posts: 2
|
Posted: Jul 4th, 2005 07:00 AM Post subject: passing in parameters in visual basic |
|
|
hello!
I have a sub with heading:
Public Sub ProcessDay(ByVal normal As Boolean, ByVal holiday As Boolean, ByVal sick As Boolean, ByVal lunch As Boolean, ByVal starthours As Double, ByVal finishhours As Double, ByVal startmins As Double, ByVal finishmins As Double, ByVal day As String)
Inside the sub i have two variables declared:
Dim hours As Double
Dim minutes As Double
I want to call another sub within this sub, but i want to pass in the two variable, change them and pass them out again.
This is where the problem is, i pass the variables in and assign values to them but the values don't get passed back to the variables in the outer sub.
Do you know how to do this?
Should i make the variables global or something?
D |
|
| Back to top |
|
DoobieKeebler Moderator

Joined: 17 Jun 2005 Posts: 254 Location: 181°15'2.003"W, 93°5'16.956"N
|
Posted: Jul 5th, 2005 09:24 AM Post subject: |
|
|
I'm still using VB6, but since you're passing variables ByVal this should be applicable. Change the parameters of the second sub so that you're passing the variables ByRef. This gives the sub the actual variables instead of just the values of the variables.
For anybody who's going "what?", when I give you my car ByVal I'm giving you a picture of my car; you can edit the picture and it won't change my actual car. When I give you my car ByRef I'm giving you my actual car. |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|