[英]VB line of code inquiry, filed = (variable = 0)
我正在使用我們的CRM程序並將一些內容編碼到系統中。 我有點基礎知識,但我並不完全熟悉它,所以我不知道這條線的含義是什么以及它實際上做了什么。 真的很感激任何幫助。
代碼看起來像這樣:
txtField.ReadOnly = (intOption = 0)
SetControlColor(txtField)
我知道intOption是什么,我知道代碼的結果是什么,但我不明白這條線真正做了什么......
撕裂它。 從右到左閱讀。 這部分行:
(intOption = 0)
是比較intOption
是否等於0
。 這將返回True
或False
。 然后txtField.ReadOnly
True
或False
值分配給txtField.ReadOnly
,這是一種Boolean
類型。
它相當於這段代碼:
If intOption = 0 Then
txtField.ReadOnly = True
Else
txtField.ReadOnly = False
End If
如您所見,將所有代碼編寫成一行更容易。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.