Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General

Post new topic   Reply to topic
passing in parameters in visual basic
View previous topic :: View next topic  
Author Message
deepod
Newbie


Joined: 15 Jun 2005
Posts: 2

PostPosted: Jul 4th, 2005 07:00 AM    Post subject: passing in parameters in visual basic Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
DoobieKeebler
Moderator


Joined: 17 Jun 2005
Posts: 254
Location: 181°15'2.003"W, 93°5'16.956"N

PostPosted: Jul 5th, 2005 09:24 AM    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic