Jump to content

Otomatik Sekme Oluşturma


muratboy31
 Share

Recommended Posts

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);
            }
Link to comment
Share on other sites

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 by muratboy31
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;

eamuyu.jpg

Edited by muratboy31
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...