P.I. Engineering User Forum

Product Support, Technical Questions and Answers, and Examples for P.I. Engineering Products

You are not logged in.

#1 2017-04-07 15:15:48

GordR
Member
Registered: 2017-04-05
Posts: 17

Passing variables to subroutine

Can you pass variables to an user declared sub routine?
This is the routine I have now.

Public Sub BkLtProgOff()
		if BkLtProg > 0
			MW3.SetSingleBacklightLED(MyDevice, BkLtProg, 1, 0)
		End If 'End program row check
	End Sub

This is what I would like to be able to do:

Public Sub BkLt(LEDNumber,RedOrBlue,OnOrOff)
		if BkLtProg > 0
			MW3.SetSingleBacklightLED(MyDevice, LEDNumber, RedOrBlue, OnOrOff)
		End If 'End check of first keypress in this group
	End Sub

Offline

#2 2017-04-10 07:40:47

PIE Amber
Technical Software Developer
From: Williamston, MI
Registered: 2016-01-21
Posts: 196
Website

Re: Passing variables to subroutine

Yes, you can do this. When you call the subroutine, pass in your variables just as you would like.


Amber from P.I. Engineering

Offline

#3 2017-04-11 17:28:57

GordR
Member
Registered: 2017-04-05
Posts: 17

Re: Passing variables to subroutine

Thank you for the reply.

After I posted, I realized that the example given wouldn't simplify the code at all, just duplicate what
SetSingleBacklightLED already does.

But it is good to know about passing variables; thanks again.

Offline

Board footer

Powered by FluxBB