vb.net Function使用

Public Function colour(ByVal Code As Int16) As Color'顏色
Select Case Code
Case 1
colour = Color.White'白色
Case 2
colour = Color.Yellow'黃色
Case 3
colour = Color.Red'紅色
Case 4
colour = Color.Silver'灰色
End Select
End Function

 

Private Sub A1()

TextBox1.BackColor = colour(1)'l背景色白

TextBox1.BackColor = colour(2)'l背景色黃

TextBox1.BackColor = colour(3)'l背景色紅

TextBox1.BackColor = colour(4)'l背景色灰

End Sub

 

转载于:https://www.cnblogs.com/leme-chen/p/9288564.html

你可能感兴趣的:(vb.net Function使用)