Jump to content

Toolstripdropdownbutton Kullanımı


korasoglu
 Share

Recommended Posts

Arkadaşlar normal olarak ekleme yapabiliyorum

ToolStripItem item = new ToolStripMenuItem();
item.Text = "Jhon Smith";
 item.Name = "Ekle";
 item.Click += new EventHandler(item_Click);

 

ama toolStripDropDownButton ekleyip  Click  yapmak istiyorum yapamadım yardımcı olursanız sevinirim

 

Link to comment
Share on other sites

DataTable data2 = SQL.GetDataTable("select ad FROM isimler");
            foreach (DataRow item in data2.Rows)
            {

                this.toolStripDropDownButton2.DropDownItems.Add(item["ad"].ToString());
               
                this.toolStripDropDownButton2.DisplayStyle = ToolStripItemDisplayStyle.Text;
              
            }

bu şekilde ekledim ama ne çalıştırabildim ne itemleri silebildim

 

toolStripDropDownButton1.DropDownItems.Clear();

ama

Edited by korasoglu
Link to comment
Share on other sites

toolStripDropDownButton1.DropDownItems.Clear();

            DataTable data = new DataTable();
            data.Columns.Add("isim");
            data.Columns.Add("sehir");

            data.Rows.Add("ali", "bursa");
            data.Rows.Add("veli", "adana");
            data.Rows.Add("ahmet", "hatay");

            foreach (DataRow item in data.Rows)
            {
                string isim = item["isim"].ToString();

                ToolStripMenuItem menuItem = new ToolStripMenuItem()
                {
                    Text = isim,
                };

                toolStripDropDownButton1.DropDownItems.Add(menuItem);
            }

 

Link to comment
Share on other sites

6 saat önce, korasoglu yazdı:

Arkadaşlar normal olarak ekleme yapabiliyorum

ToolStripItem item = new ToolStripMenuItem();
item.Text = "Jhon Smith";
 item.Name = "Ekle";
 item.Click += new EventHandler(item_Click);

 

ama toolStripDropDownButton ekleyip  Click  yapmak istiyorum yapamadım yardımcı olursanız sevinirim

 

private void Form2_Load(object sender, EventArgs e)

{

ToolStrip menu = new ToolStrip();

ToolStripItem item = new ToolStripMenuItem();

item.Width = 100;

item.Name = "ToolStripMenuItem1";

item.Text = "ToolStripMenuItem1";

this.Controls.Add(menu);

menu.Items.Add(item);

 

item.Click += new EventHandler(item_Click);

}

void item_Click(object sender, EventArgs e)

{

Form1 frm = new Form1();

frm.Show();

this.Hide();

}

 

 

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...