プロジェクトに編集ボタンがあり、リストボックスの行を編集できますが、編集可能にしたくない特定の行があります。どうすればそれを可能にできますか?
4、9、14、19、24、29、34、39、44、49、54、59、64、69、74、79、84、89、94、99行目を編集不可にしたい。
applicationdate 行を編集不可にしたいのですが、そのコード行を編集不可にする方法はありますか。
プロジェクトに編集ボタンがあり、リストボックスの行を編集できますが、編集可能にしたくない特定の行があります。どうすればそれを可能にできますか?
4、9、14、19、24、29、34、39、44、49、54、59、64、69、74、79、84、89、94、99行目を編集不可にしたい。
applicationdate 行を編集不可にしたいのですが、そのコード行を編集不可にする方法はありますか。
SelectedIndexChanged
イベントを処理します。このイベントは、ListBox
コントロール内の項目の選択が変更されるたびに発生します。
このイベントのイベント ハンドラー メソッド内で、現在選択されている項目のインデックスを確認します。編集を許可したい場合は、[編集] ボタンを有効にします。それ以外の場合は、[編集] ボタンを無効にします。
例えば:
Private Sub myListBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles myListBox.SelectedIndexChanged
' Only allow editing of items with an odd-numbered index.
' (This isn't very useful, just a demonstration. You can use any criteria you
' want to determine whether editing should be allowed for the current item.)
btnEdit.Enabled = myListBox.SelectedIndex Mod 2
End Sub
Private Sub myListBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles myListBox.SelectedIndexChanged
' Only allow editing of items with an odd-numbered index.
' (This isn't very useful, just a demonstration. You can use any criteria you
' want to determine whether editing should be allowed for the current item.)
Dim unedit() as integer={4, 9, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59, 64, 69, 74, 79, 84, 89, 94, 99}
dim i as integer
for i = 0 unedit.count-1
if myListBox.SelectedIndex=unedit(i) then
btnEdit.Enabled = false
exit for
end if
End Sub