• 08-06-2014, 22:19:31
    #1
    Selam Arkadaşlar yeni yeni C# ile uğraşmaya başladım ancak çözemediğim ve çözümünü bulamadığım bir sorunum var

    kayıtlı bilgileri düzenlemek için bir form oluşturdum. ilk müşteri bilgilerini düzenlerken sorun yok ancak ikinci müşteriyi yada diğerlerini düzenlemek istediğimde combobox da ki seçenekler iki katına çıkıyor. tekrar kapatıp düzenle dediğimde 3 katına çıkıyor

    kodlarım bu şekilde;
     private void Form3_Load(object sender, EventArgs e)
            {
                
             
                textBox1.Text = frm2.dataGridView1.CurrentRow.Cells[2].Value.ToString();
                textBox2.Text = frm2.dataGridView1.CurrentRow.Cells[3].Value.ToString();
                textBox3.Text = frm2.dataGridView1.CurrentRow.Cells[4].Value.ToString();
                textBox4.Text = frm2.dataGridView1.CurrentRow.Cells[5].Value.ToString();
                textBox5.Text = frm2.dataGridView1.CurrentRow.Cells[6].Value.ToString();
                comboBox2.Text = frm2.dataGridView1.CurrentRow.Cells[7].Value.ToString();
                textBox6.Text = frm2.dataGridView1.CurrentRow.Cells[0].Value.ToString();
                textBox7.Text = frm2.dataGridView1.CurrentRow.Cells[8].Value.ToString();
                textBox8.Text = frm2.dataGridView1.CurrentRow.Cells[9].Value.ToString();
                textBox9.Text = frm2.dataGridView1.CurrentRow.Cells[10].Value.ToString();
                textBox10.Text = frm2.dataGridView1.CurrentRow.Cells[11].Value.ToString();
                textBox11.Text = frm2.dataGridView1.CurrentRow.Cells[12].Value.ToString();
                textBox12.Text = frm2.dataGridView1.CurrentRow.Cells[13].Value.ToString();
                textBox13.Text = frm2.dataGridView1.CurrentRow.Cells[14].Value.ToString();
                comboBox1.Text = frm2.dataGridView1.CurrentRow.Cells[15].Value.ToString();
                comboBox1.Items.Add("Evrak Bekleniyor");
                comboBox1.Items.Add("Kredi İşlemde");
                comboBox1.Items.Add("Kredi Onaylandı");
                comboBox1.Items.Add("Kredi Kullandırıldı");
                comboBox1.Items.Add("Kredi Red");
                comboBox1.Items.Add("İşleme Alınacak");
                comboBox2.Items.Add("SSK lı ");
                comboBox2.Items.Add("Emekli");
                comboBox2.Items.Add("Bağkur");
                comboBox2.Items.Add("Kamu");
                comboBox2.Items.Add("Sgk Yok");
            }
  • 08-06-2014, 23:59:00
    #2
    en başa hangi comboboxta sorun varsa comboboxismi.items.clear(); yazın sorunun çözülmesi gerek
  • 09-06-2014, 00:02:15
    #3
    private void Form3_Load(object sender, EventArgs e)
    {
    comboBox1.Items.Clear(); //combobox1 de ki önceden yüklenmiş itemları temizler
    comboBox2.Items.Clear(); //combobox2 de ki önceden yüklenmiş itemları temizler
    textBox1.Text = frm2.dataGridView1.CurrentRow.Cells[2].Value.ToString();
    textBox2.Text = frm2.dataGridView1.CurrentRow.Cells[3].Value.ToString();
    textBox3.Text = frm2.dataGridView1.CurrentRow.Cells[4].Value.ToString();
    textBox4.Text = frm2.dataGridView1.CurrentRow.Cells[5].Value.ToString();
    textBox5.Text = frm2.dataGridView1.CurrentRow.Cells[6].Value.ToString();
    comboBox2.Text = frm2.dataGridView1.CurrentRow.Cells[7].Value.ToString();
    textBox6.Text = frm2.dataGridView1.CurrentRow.Cells[0].Value.ToString();
    textBox7.Text = frm2.dataGridView1.CurrentRow.Cells[8].Value.ToString();
    textBox8.Text = frm2.dataGridView1.CurrentRow.Cells[9].Value.ToString();
    textBox9.Text = frm2.dataGridView1.CurrentRow.Cells[10].Value.ToString();
    textBox10.Text = frm2.dataGridView1.CurrentRow.Cells[11].Value.ToString();
    textBox11.Text = frm2.dataGridView1.CurrentRow.Cells[12].Value.ToString();
    textBox12.Text = frm2.dataGridView1.CurrentRow.Cells[13].Value.ToString();
    textBox13.Text = frm2.dataGridView1.CurrentRow.Cells[14].Value.ToString();
    comboBox1.Text = frm2.dataGridView1.CurrentRow.Cells[15].Value.ToString();
    comboBox1.Items.Add("Evrak Bekleniyor");
    comboBox1.Items.Add("Kredi İşlemde");
    comboBox1.Items.Add("Kredi Onaylandı");
    comboBox1.Items.Add("Kredi Kullandırıldı");
    comboBox1.Items.Add("Kredi Red");
    comboBox1.Items.Add("İşleme Alınacak");
    comboBox2.Items.Add("SSK lı ");
    comboBox2.Items.Add("Emekli");
    comboBox2.Items.Add("Bağkur");
    comboBox2.Items.Add("Kamu");
    comboBox2.Items.Add("Sgk Yok");
    }

    Yukarıda kırmızı ile belirttiğim kodları yazdığım yerlere eklersen sorunun çözülür. Kodun açıklaması yorum satırı olarak yazıyor
  • 09-06-2014, 13:37:42
    #4
    çok teşekkürler arkadaşlar