Item is Selected with the ListBox MultiSelect Property Set To None...
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 264   1
URL.หัวข้อ / URL
Item is Selected with the ListBox MultiSelect Property Set To None...

ถามไว้ที่ 
http://www.utteraccess.com/forums/showflat.php?Cat=&Board=AxxessXP&Number=119827&page=0&view=collapsed&sb=5&o=&fpart=1&vc=1&PHPSESSID= 
 
ถ้า List Box กำหนดให้ Multiselect ให้เป็น None จะรู้ได้อย่างไรว่ารายการไหนถูกเลือกไว้บ้าง  
และจะยกเลิกการเลือกรายการนั้นอย่างไร 
 
ผมเลยให้โค้ดเขาไปดังนี้ครับ 
 
โค้ดสำหรับหาดูว่ารายการใดใน List ถูกเลือกไว้ 
 
Private Sub cmdShowSelectedItem_Click() 
Dim intItem As Integer 
Dim intCurrent As Integer 
 
intItem = Me.List5.ListCount - 1 
For intCurrent = 0 To intItem 
    If Me.List5.Selected(intCurrent) = True Then 
        MsgBox "You are selected " & Me.List5.Column(0, intCurrent) 
        Exit Sub 
    End If 
Next 
 
End Sub 
 
โค้ดสำหรับยกเลือกการเลือกรายการที่ถูกเลือกไว้ 
 
Private Sub cmdDeSelect_Click() 
Dim intItem As Integer 
Dim intCurrent As Integer 
 
intItem = Me.List5.ListCount - 1 
For intCurrent = 0 To intItem 
    If Me.List5.Selected(intCurrent) = True Then 
        Me.List5.Selected(intCurrent) = False 
        Exit Sub 
    End If 
Next 
End Sub 
 
โดย List Box ของผมชื่อ List5 ครับ 
 
*** Edited by Supap Chaiya *** 6/2/2547 13:17:04

1 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R06584
   
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0534s