Jump to content

Kastamonolu

Yeni Üye
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Kastamonolu

  1. C# Excelde ki verileri datagridview'e kopyalama da bekletme

    Merhabalar,

    Yazdığım bir tane program var bu program excelde kopyaladığımız verileri datagridview'e yapıştırması lazım aşağıda atacağım kod yapıştırıyor ancak 50-100 arasındaki verileri anında ekliyor diğer yani büyük verileri 10000-20000 gibi verileri eklerken program "Yanıt Vermiyor" durumuna düşüyor. Fakat 3-4 dk sonra program düzeliyor ve verileri yapıştırmış oluyor. Bu bekletme olayını neden yapıyor veya nasıl çözebilirim? Bana bir yol önerirmisiniz.

     

     

                try
                {
                    IDataObject obj = Clipboard.GetDataObject();
                    string s = Clipboard.GetText();
                    string[] lines = s.Split('\n');
                    int iFail = 0;
    
                    bool headerSelected = false;
                    if (dataGridView1.CurrentRow != null)
                    {
                        headerSelected = dataGridView1.CurrentRow.Selected;
                    }
    
                    int iCol = dataGridView1.ColumnCount - 1, iRow = dataGridView1.RowCount - 1;
                    foreach (DataGridViewCell cell in dataGridView1.SelectedCells)
                    {
                        if (cell.ColumnIndex < iCol || cell.RowIndex < iRow)
                        {
                            iCol = cell.ColumnIndex;
                            iRow = cell.RowIndex;
                        }
                    }
    
                    foreach (string line in lines)
                    {
                        if (line.Length > 0)
                        {
                            if (iRow < dataGridView1.RowCount)
                            {
                                string[] sCells = line.Split('\t');
                                int offset = 0;
                                for (int i = 0; (headerSelected ? i + 1 : i) < sCells.GetLength(0); ++i)
                                {
                                    if (iCol + i < dataGridView1.ColumnCount)
                                    {
                                        while (!dataGridView1[iCol + i + offset, iRow].Visible && iCol + i + offset + 1 < dataGridView1.ColumnCount)
                                        {
                                            offset++;
                                        }
                                        if (dataGridView1[iCol + i + offset, iRow].Visible)
                                        {
                                            try
                                            {
                                                dataGridView1.CurrentCell = dataGridView1[iCol + i + offset, iRow];
                                            }
                                            catch
                                            {
                                                ;
                                            }
                                            if (!dataGridView1.CurrentCell.ReadOnly)
                                            {
                                                string value = headerSelected ? sCells[i + 1] : sCells[i];
                                                if (dataGridView1.CurrentCell.Value == null || dataGridView1.CurrentCell.Value.ToString() != value)
                                                {
                                                    dataGridView1.BeginEdit(true);
                                                    if (dataGridView1.EditingControl != null)
                                                    {
                                                        dataGridView1.EditingControl.Text = value;
                                                    }
                                                    else
                                                    {
                                                        dataGridView1.CurrentCell.Value = Convert.ChangeType(sCells[i], dataGridView1.CurrentCell.ValueType);
                                                    }
                                                    dataGridView1.NotifyCurrentCellDirty(true);
                                                    dataGridView1.EndEdit();
                                                }
                                            }
                                            else
                                            {
                                                iFail++;
                                            }
                                        }
                                        else
                                        {
                                            iFail++;
                                        }
                                    }
                                }
                                iRow++;
                            }
                        }
                        else
                        {
                            break;
                        }
                        if (iFail > 0)
                        {
                            MessageBox.Show(string.Format("{0} güncellemeleri " + " yalnızca sütun ayarını okumak için başarısız oldu ", iFail));
                        }
                    }
                }
                catch (FormatException)
                {
                    MessageBox.Show("Yapıştırdığınız veriler hücrenin yanlış biçimindedir.", "Hata Penceresi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

     

  2. nous, 2 saat önce yazdı:

    TeamViewer Free 14.0.12762 Türkçe | Katılımsız

      İçeriği Görüntüle

    9138676ed347aeff0885d35edc1c56e4.jpg

    • Yönetici olarak Çalıştırın.
    • "Kurulum Tamamlandı!" uyarısı çıkana kadar bekleyin.

    MD5: CCF6AEFD6BBCF9D6BED4A0EF0CBA7845

    (21,86Mb)

    ca087070267278d8086da7a2c5c0d265.gif

    
    http://turbobit.net/qclp50bxfmlt.html
    https://userscloud.com/mk5luj4mp1f5

     

     

    Bu katılımsız olarak sunduklarında süre sınırı varmı?

×
×
  • Create New...