コードでコントロールのプロパティを設定する方法を教えてください

VBでコントロールのプロパティを設定するには、次のコードを使用できます:

  1. コントロール名.プロパティ = 値
Button1.Text = "点击我"
Label1.Font = New Font("Arial", 12, FontStyle.Bold)
TextBox1.Enabled = False
  1. コントロール.プロパティ=””
Button1.SetProperty("Text", "点击我")
Label1.SetProperty("Font", New Font("Arial", 12, FontStyle.Bold))
TextBox1.SetProperty("Enabled", False)
  1. コントロール名.プロパティ.プロパティ = 値
Button1.Properties.Appearance.BackColor = Color.Red
Label1.Properties.ReadOnly = True
TextBox1.Properties.MaxLength = 10

対象とするコントロールの種類によって、使用できるプロパティや設定可能な値が変わり、上述の例は一般的なプロパティ設定方法の一部を示すのみです。

bannerAds