Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
成都創(chuàng)新互聯(lián)公司成立于2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元常寧做網(wǎng)站,已為上家服務(wù),為常寧各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:13518219792
If e.KeyChar.ToString() = Chr(13) Then
Dim str As String = TextBox1.Text
If Not ListBox1.Items.Contains(str) Then
ListBox1.Items.Add(str)
End If
End If
End Sub
Private Sub btn_Remove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex 0 Then
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub
Private Sub btn_Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
End Sub
For?i?=?List1.ListCount?-?1?To?0?Step?-1
If?List1.Selected(i)?Then
List1.RemoveItem?(i)
End?If
Next?i
用列表框的方法list.delete。
List1.RemoveItem 0 '刪除第1項(xiàng)
List1.RemoveItem 1 '刪除第2項(xiàng)
List1.RemoveItem 2 '刪除第3項(xiàng)
List1.Clear '全部清空
擴(kuò)展資料:
注意事項(xiàng)
獲取單選按鈕的值
$('input:radio:checked').val();
獲取下拉框的值
$('#id option:selected').val();
重置清空值
$("#id")[0].reset();
$("#id").find(':input[type=text]').val(); $('#id').find(':text').val();
重置清空下拉框的值
方式1:
$('#id' option:first').prop('selected','selected');
$('#id').trigger('change.select2');
方式2:
$('#id').val('03').trigger("change");
清除單選框的checked屬性
$("input[type='radio']").removeAttr('checked');
文章標(biāo)題:vb.net列表框刪除 vb中如何刪除列表框里的所選項(xiàng)
網(wǎng)站路徑:http://aaarwkj.com/article22/hhpcjc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、企業(yè)建站、外貿(mào)網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站建設(shè)、服務(wù)器托管、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)