الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

الإكمال التلقائي للمدخلات

مغلق
بدأه دريد2 في 7 مايو 2005 · 6 رد · 875 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

يا أخوان كيف يتم الإكمال التقائي في الكومبو بوكس

مثلا لو كان عندي في الكومبو بوكس الأسماء التالية :

ناصر

نور

نعمان

وفي حالة أني أريد مثلا اسم ( نعمان ) ، فإنني أول ما أكتب حرف (النون) يقوم الكومبو بوكس بتكملة باقي الحروف تلقائيا .

ولقد أرفقت لكم مثالا لتوضيح المطلوب !

شاكرا لكم حسن تعاونكم مع الأعضاء ، وإلى اللقاء .

AutoComplete.zip

تم تعديل هذه المشاركة بواسطة دريد2 في 7 مايو 2005 في 23:34

#2

السلام عليكم

PIC2004111521303811.JPG

Flat-Multicolumn combobox with autocomplete

AutoCompleteTextbox

AutoComplete ComboBox

{وَاتَّقُواْ يَوْمًا تُرْجَعُونَ فِيهِ إِلَى اللّهِ ثُمَّ تُوَفَّى كُلُّ نَفْسٍ مَّا كَسَبَتْ وَهُمْ لاَ يُظْلَمُونَ} (281) سورة البقرة

br17.gif

برنامج الإتصلات الإدارية والارشيف الالكتروني

برنامج الخبير لنقاط البيع المباشرة

#3

مرحبا يا اخي هل من الممكن تزويدنا بالمثال الذي بالصورة

وشكرا جزيلا

#4

سلام عليكم

Private Sub cboName_Leave(ByVal sender As Object, ByVal e As System.EventArgs) 
                                                            Handles cboName.Leave
    Dim recRowView As DataRowView
    Dim recName As DB.tblNameRow

    AutoCompleteCombo_Leave(cboName)

    'OPTIONAL: Now you can  do some extra handling if you want

    'Get the Selected Record from my Data Bound Combo (Return Type is DataRowView)
    recRowView = cboName.SelectedItem
    If recRowView Is Nothing Then Exit Sub

    'Display the Name Info (Row Type comes from my bound Dataset)
    recName = recRowView.Row
    lblAccountNum.Text = recName.AccountNum
    lblCompanyName.Text = recName.CompanyName

End Sub

Private Sub cboName_KeyUp(ByVal sender As Object, 
              ByVal e As System.Windows.Forms.KeyEventArgs) Handles cboName.KeyUp

    AutoCompleteCombo_KeyUp(cboName, e)

End Sub

Public Sub AutoCompleteCombo_KeyUp(ByVal cbo As ComboBox, ByVal e As KeyEventArgs)
    Dim sTypedText As String
    Dim iFoundIndex As Integer
    Dim oFoundItem As Object
    Dim sFoundText As String
    Dim sAppendText As String

    'Allow select keys without Autocompleting
    Select Case e.KeyCode
        Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down
            Return
    End Select

    'Get the Typed Text and Find it in the list
    sTypedText = cbo.Text
    iFoundIndex = cbo.FindString(sTypedText)

    'If we found the Typed Text in the list then Autocomplete
    If iFoundIndex >= 0 Then

        'Get the Item from the list (Return Type depends if Datasource was bound 
        ' or List Created)
        oFoundItem = cbo.Items(iFoundIndex)

        'Use the ListControl.GetItemText to resolve the Name in case the Combo 
        ' was Data bound
        sFoundText = cbo.GetItemText(oFoundItem)

        'Append then found text to the typed text to preserve case
        sAppendText = sFoundText.Substring(sTypedText.Length)
        cbo.Text = sTypedText & sAppendText

        'Select the Appended Text
        cbo.SelectionStart = sTypedText.Length
        cbo.SelectionLength = sAppendText.Length

    End If

End Sub


Public Sub AutoCompleteCombo_Leave(ByVal cbo As ComboBox)
    Dim iFoundIndex As Integer

    iFoundIndex = cbo.FindStringExact(cbo.Text)

    cbo.SelectedIndex = iFoundIndex

End Sub

" اللهم لاسهل إلا ماجعلته سهلاً وأنت تجعل الحزن إذا شئت سهلاً "

003.gif

قواعد طرح الأسئله والمشاركات

-------------------

MSN Messenger : nontop@gmail.com

Happy coding

-------------------

#5

هل يوجد AutoCompletion فى الـTextBox

Nothing to mention except that I am Muslim

Using your brain is not bad as you think

My Blog

logo.jpg

#6

ألف مليون شكر يا أخي الكريم waleedhm على مجهودك العظيم في الإجابة

والشكر موصول للأخ Non-top وعلى تعبه في البحث عن الكود المناسب

والشكر أيضا لكل من ساهم أو قرأ هذا المقال . وفقكم الله ونفعنا بعلمكم .

هذا الموضوع مغلق.

مواضيع مشابهة