Skip to content

Instantly share code, notes, and snippets.

@ebubekirbastama
Created March 7, 2024 22:02
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace PropertyGrid_Ornegi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
List<Control> tumNesneler = new List<Control>();
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control control in this.Controls)
{
tumNesneler.Add(control);
}
foreach (var item in tumNesneler)
{
comboBox2.Items.Add(item.Name + ":" + item.GetType().Name);
}
comboBox1.DataSource = tumNesneler;
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
Control secilenNesne = (Control)comboBox1.Items[comboBox2.SelectedIndex];
string nesneAdi = secilenNesne.Name;
string nesneCinsi = secilenNesne.GetType().Name;
propertyGrid1.SelectedObject = secilenNesne;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment