korasoglu Posted September 30, 2016 Share Posted September 30, 2016 Arkadaşlar şimdiden her birinize çok teşekkür ederim, ben a uygulasındaki tabloyu b uygulasında nasıl kullanabilirim. Yani a.exe de korasoglu tablesine load yaptıktan sonra b.exeyi çağırdığım zaman form yüklenince korasoglu tablesini nasıl kullanabilirim. Mantık aynen şu excelde kopyalama yaptın başka kitap açtığın zaman yapıştırabiliyorsun demekki sistem hafızasında tablo kullanılabiliyor bu özelliği biz nasıl kullanabiliriz Araştırdım fakat dökümanlar ingilizce bir şey anlamadım bilen varsa yardımcı olursa çok sevinirim. Quote Link to comment Share on other sites More sharing options...
artal73 Posted September 30, 2016 Share Posted September 30, 2016 Belleğe yüklenen Tabloyu geçici bir "xml" dosyasına yazıp, 2. uygulamaya oradan okutabilirsiniz. Quote Link to comment Share on other sites More sharing options...
Extended Posted September 30, 2016 Share Posted September 30, 2016 https://www.tnctr.com/topic/340985-başka-class-kontrolü/ Quote Link to comment Share on other sites More sharing options...
korasoglu Posted September 30, 2016 Author Share Posted September 30, 2016 (edited) hafızaya alıyoruz ------------------------------------------------------------------------- var newline = System.Environment.NewLine; var tab = "\t"; var hafiza = new StringBuilder(); foreach (DataGridViewRow row in dataGridView1.Rows) { for (int i = 0; i < row.Cells.Count; i++) { if (i == (row.Cells.Count - 1)) hafiza.Append(row.Cells.Value + newline); else hafiza.Append(row.Cells.Value + tab); } ------------------------------------------------- hafızadan okuyoruz --------------------------------------- DataTable tumu = new DataTable(); int aa = -1; string[] aylar = {"2016","Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" }; DataObject o = (DataObject)Clipboard.GetDataObject(); if (o.GetDataPresent(DataFormats.Text)) { if (dg.RowCount > 0) dg.Rows.Clear(); if (dg.ColumnCount > 0) dg.Columns.Clear(); bool columnsAdded = false; string[] pastedRows = Regex.Split(o.GetData(DataFormats.Text).ToString().TrimEnd("\r\n".ToCharArray()), "\r\n"); foreach (string pastedRow in pastedRows) { string[] pastedRowCells = pastedRow.Split(new char[] { '\t' }); if (!columnsAdded) { aa++; for (int i = 0; i < pastedRowCells.Length; i++) { dg.Columns.Add(i.ToString(), aylar); //dg.Columns.Add("col" + i, pastedRowCells); tumu.Columns.Add(i.ToString()); aa++; columnsAdded = true; continue; } } dg.Rows.Add(); int myRowIndex = dg.Rows.Count - 1; // MessageBox.Show(dg.Columns.Count.ToString()); using (DataGridViewRow myDataGridViewRow = dg.Rows[myRowIndex]) { for (int i = 0; i < pastedRowCells.Length; i++) { myDataGridViewRow.Cells.Value = pastedRowCells; } } } } ben zaten tablede columnsları oluşturuyorum sadace satırları ekleyemedim yani gelen veriyi tabloyada yüklemek istiyorum. Edited September 30, 2016 by korasoglu Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.