أبو عبدالله الحلوانى قام بنشر يوليو 23, 2017 قام بنشر يوليو 23, 2017 السلام عليكم الموضوع باختصار أنه لدينا لست بوكس listBox يتم الاختيار منه لملأ مربع نص textBox والمطلوب عند التراجع عن الاختيار من الليست listBox كيف يمكن حذف القيمة من التكست textBox أرجو أن تكون الفكرة واضحة وهنا مرفق TestList.rar
تمت الإجابة jjafferr قام بنشر يوليو 24, 2017 تمت الإجابة قام بنشر يوليو 24, 2017 وعليكم السلام اخوي ابو عبدالله ايش رايك بهذه الطريقة ، اختيار اعضاء الفريق ، هو الذي يقرر التشكيل ، والكود يذكرك بالاعضاء المختارين ، كلما تختار الفريق: وهذا هو الكود: Private Sub List0_AfterUpdate() On Error GoTo err_List0_AfterUpdate List2.RowSource = "" List2.RowSource = "Select TypID,MemprName From MemprsTbl Where TypID=" & Me.List0.Column(0) 'everytime we click in List0, we look in Text4 items, 'every item in Text4, we select it in List2 'now show the items selected before, and exist Text4 now Dim x() As String 'split each line of Text4 based on vbCrLf x = Split(Nz(Me.Text4, ""), vbCrLf) 'loop through all the lines For i = LBound(x) To UBound(x) For j = 0 To List2.ListCount - 1 'now loop through List2 strSelected = Me.List2.Column(1, j) & ";" & Me.List2.Column(0, j) If x(i) = strSelected Then 'select List2 item if it is the same as Text4 Me.List2.Selected(j) = True End If Next j Next i Exit Sub err_List0_AfterUpdate: If Err.Number = 94 Or Err.Number = 9 Then Resume Next Else MsgBox Err.Number & vbCrLf & Err.Description End If End Sub Private Sub List2_Click() On Error GoTo err_List2_Click 'everytime we click in List2, we look in Text4 items, 'if there are Selected in List2, we leave it in Text4, 'if there are Not Selected in List2, we remove them from Text4 'loop through List2 items For i = 0 To List2.ListCount - 1 strSelected = Me.List2.Column(1, i) & ";" & Me.List2.Column(0, i) If Me.List2.Selected(i) Then 'is List2 item selected, add it to Text4 'but is it there already If InStr(Nz(Me.Text4, ""), strSelected) = 0 Then Me.Text4 = Me.Text4 & strSelected & vbCrLf End If Else 'Remove from Text4 Me.Text4 = Replace(Me.Text4, strSelected & vbCrLf, "") End If Next i Exit Sub err_List2_Click: If Err.Number = 94 Then Resume Next Else MsgBox Err.Number & vbCrLf & Err.Description End If End Sub جعفر 693.TestList2.mdb.zip 5
أبو عبدالله الحلوانى قام بنشر يوليو 24, 2017 الكاتب قام بنشر يوليو 24, 2017 جزاكم الله خيرا وزادكم فضلا وعلما وبركة فى العمر والمال والأهل تم 1
الردود الموصى بها
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.