ComboBox Nesnesinde Otomatik Tamamlama
İlk önce Şekil 1 deki gibi comboBox1.AutoCompleteMode =AutoCompleteMode.SuggestAppend; olarak seçin. Daha sonra ComboBox nesnesinin AutoCompleteSource i AutoCompleteSource.CustomSource; seçiyoruz. Oluşturulan String Koleksiyonumuzu AutoCompleteSource kısmında gösterimini sağlıyoruz.

Şekil 1

Şekil 2

Şekil 1

Şekil 2
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Bu kısımda AllSystemSource, AllUrl de seçilebilir.
//Burada CustomeSource ü seçiyoruz.
comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
// AutoComplete String Koleksiyonu oluşturuyoruz.
AutoCompleteStringCollection veri = new AutoCompleteStringCollection();
veri.Add("Bahadır ŞAHİN");
veri.Add("Haluk Aydın");
veri.Add("Fatih Koç");
veri.Add("Bülent Ceyhun");
veri.Add("Mehmet Alp");
comboBox1.AutoCompleteCustomSource = veri;
}
}
}
2 gündür aradığım özellikti çok teşekkürler.
YanıtlaSil