muratboy31 Posted October 5, 2015 Share Posted October 5, 2015 Arkadaşlar merhaba, veri tabanındaki bir tablodan bilgi çekilerek tab control da tab oluştumak istiyorum bunu nasıl yapabilirm acaba ? Devexpress xtraTabControl ile yapmak istiyorum. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted October 5, 2015 Share Posted October 5, 2015 using DevExpress.XtraTab; şeklinde gerekli namespace'i ekledikten sonra: DataTable data = new DataTable(); data.Columns.Add("isim"); data.Columns.Add("sehir"); data.Rows.Add("ali", "mersin"); data.Rows.Add("ahmet", "bursa"); foreach (DataRow item in data.Rows) { string isim = item["isim"].ToString(); XtraTabPage tab = new XtraTabPage() { Text = isim }; xtraTabControl1.TabPages.Add(tab); } Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted October 5, 2015 Author Share Posted October 5, 2015 (edited) Teşekkürler Kintaro Peki bu oluşturduğum Tab içine bir listbox nasıl eklerim acaba ? Bunda da devexpress listboxcontrol kullanmak istiyorum. bunu denedim ama olmadı , hepsine aynı isimler geliyor; komut.Connection = baglanti; komut.CommandText = "Select Name From Offices"; baglanti.Open(); MySqlDataReader oku; oku = komut.ExecuteReader(); while (oku.Read()) { string isim = oku.GetString(0); XtraTabPage tab = new XtraTabPage() { Text = isim }; xtraTabControl1.TabPages.Add(tab); ListBoxControl listBox = new ListBoxControl() { Name = isim }; listBox.Parent = xtraTabControl1; listBox.Dock = DockStyle.Fill; listBox.Items.Add(isim); } Edited October 5, 2015 by muratboy31 Quote Link to comment Share on other sites More sharing options...
KintaRo Posted October 5, 2015 Share Posted October 5, 2015 using DevExpress.XtraTab; using System; using System.Data; using System.Windows.Forms; namespace DevEx_Sekme_Olusturma { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { DataTable data = new DataTable(); data.Columns.Add("isim"); data.Columns.Add("sehir"); data.Rows.Add("ali", "mersin"); data.Rows.Add("ahmet", "bursa"); foreach (DataRow item in data.Rows) { string isim = item["isim"].ToString(); XtraTabPage tab = new XtraTabPage() { Text = isim }; xtraTabControl1.TabPages.Add(tab); ListBox lbox = new ListBox(); lbox.Dock = DockStyle.Fill; lbox.Items.Add("1"); lbox.Items.Add("2"); lbox.Items.Add("3"); tab.Controls.Add(lbox); } } } } ben listboxu tab'ın içini dolduracak şekilde yaptım. eğer tabın içini tamamen doldurmak istemiyorsanız lbox.Dock = DockStyle.Fill; yerine X, Y ile konumunu, Width Height ile boyutunu manuel olarak belirtebilirsiniz. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted October 5, 2015 Author Share Posted October 5, 2015 (edited) teşekkürler Kintaro bunu daha kolay yapmanın yolu var mıdır ; yapmak istediğim kişileri bulundukları ofislerin listbox una eklemek. ancak kişileri listboxlara ekleyemedim ! Edited October 5, 2015 by muratboy31 Quote Link to comment Share on other sites More sharing options...
KintaRo Posted October 5, 2015 Share Posted October 5, 2015 ofis isimlerden tab oluşturup, o tablardaki listboxa da o ofislerde çalışan personelleri mi listeleteceksin? Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted October 5, 2015 Author Share Posted October 5, 2015 evet, ofis ID leri ofis tablsounda ve çalışan tablosunda bu ID ler OfficeID diye bir alanda. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted October 5, 2015 Share Posted October 5, 2015 evet yapılır ama burada anlatamam sanırım, db yok elimde, team verirsen bakabiliriz. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted October 5, 2015 Author Share Posted October 5, 2015 (edited) Bir türlü beceremedim, herşey tamam sadece çalışanları ekleyemiyorum geçerli listboxlara !!! ; istediğim tablodan officeleri tab olarak eklemek, bu eklenen tablolardaki listboxlara farklı bir tablodaki çalışanları eklemek; Edited October 5, 2015 by muratboy31 Quote Link to comment Share on other sites More sharing options...
KintaRo Posted October 5, 2015 Share Posted October 5, 2015 // çalışan ekle bu kısımda listBox kontrolü oluşturuyosun ve ona ekliyosun, ama yukarda bir listbox oluşturmuştun zaten, orada mantıksal hata var. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted October 6, 2015 Author Share Posted October 6, 2015 (edited) Veri tabanından null değer döndüğü için olmuyormuş, form onload da hata vermiyor ancak button click olayında hata verince fark ettim... Edited October 6, 2015 by muratboy31 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.