Multiple Variables

后端 未结 9 2007
不知归路
不知归路 2020-12-19 04:49

Is there a way to give a value to multiple variables (integers in this case), instead of all at once?

For instance, I have Dim aceVal, twoVal, threeVal, fourVa

9条回答
  •  無奈伤痛
    2020-12-19 05:36

    There is no way in vb.net to assign them all on one line like threeVal=fourVal=SixVal.

    If you need all these variables then one line at a time is the way. I would suggest if -1 is going to be used a lot then create a constant for it and assign the var's to the constant.

    I would also consider using an array or collection to store all your values if possible and work with them in order for setting / retrieving their values. You then won't have to have 60 variables littered all in your code. Array and/or collection would be a little cleaner.

提交回复
热议问题