SetBit - method of object Pm

Changing a bit of the variable.
SetBit(vFrom As Variant, nIndex As Integer, bValue As Boolean) As Variant
x = Pm.SetBit(vFrom, nIndex, bValue)
vFrom(Variant) Value whose bit has to be changed. The value must be integer (Byte, Integer, Long).
nIndex(Integer) Index of the bit in the variable (zero-based index).
bValue(Boolean) New value of the bit (true or false).
It doesn't change the value of the vFrom variable directly but it returns new value that can be put into the variable.
The method can also be called in the graphic item events for Web panels.

In the JavaScript language, it is better to use the standard bit operators for setting and reading the bit.

Setting the 20th bit in the BitMask variable
VBScriptSelect and copy to clipboard

BitMask = Pm.SetBit(CLng(BitMask), 20, true)
CLng is needed when originally the BitMask was not of the Long data type. If it has been, for example, Integer, then the 20th bit of the value doesn't exist and the method would fail.
PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
- Pm
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- SetBit
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice