SoFunction
Updated on 2025-03-07

C# method to implement ComboBox control to display multiple data source attributes

C# method to implement ComboBox control to display multiple data source attributes

Updated: September 16, 2015 12:22:16 Author: My Heart Still
This article mainly introduces the method of C# to display multiple data source attributes in the ComboBox control. The example analyzes the skills of using ComboBox control, which has certain reference value. Friends who need it can refer to it.

This article describes the method of C# implementing the ComboBox control to display multiple data source attributes. Share it for your reference. The details are as follows:

public partial class Form4 : Form
{
  private Bitmap myBitmap;
  public Form4()
  {
   InitializeComponent();
   DataTable dt = new DataTable();
   DataColumn dc1 = new DataColumn("Name", typeof());
   DataColumn dc2 = new DataColumn("Age", typeof());
   (dc1);
   (dc2);
   for (int i = 0; i < 20; i++)
   {
    DataRow row = ();
    row["Name"] = ();
    row["Age"] = ();
    (row);
   }
    = dt;
  }
  private void comboBox1_Format(object sender, ListControlConvertEventArgs e)
  {
   DataRowView myDataRowView = (DataRowView)();
    = ("{0}-{1}-{2}", myDataRowView["Name"], myDataRowView["Name"], myDataRowView["Name"]);
  }
}

I hope this article will be helpful to everyone's C# programming.

  • C#
  • ComboBox
  • Data Source

Related Articles

  • C# uses delegate BeginInvoke to do asynchronous threads

    Today, the editor will share with you an article about using commissioned BeginInvoke to make asynchronous threads. The editor thinks the content is quite good. Now I share it with you. It has good reference value. Friends in need will follow the editor to take a look.
    2019-01-01
  • Detailed explanation of how C# can implement screen amplification and color collection functions

    This article mainly introduces in detail how to use C# to achieve screen amplification and color collection functions. The sample code in the article is explained in detail, which is of some help to our learning C#. Interested friends can learn about it.
    2022-12-12
  • Implementation method of C# combined with JavaScript to verify data input of Web controls

    In the entry interface of a web application, data verification is an important implementation function. Data verification refers to confirming the data input or selection of the Web control. In this article, we will introduce how to verify the validity of data input of the Web control through the C# backend and JavaScript frontend. Interested friends can refer to it.
    2024-05-05
  • WPF enables online preview and display of Word and PDF files

    This article mainly introduces in detail how to use WPF to preview and display Word and PDF files online. The sample code in the article is explained in detail. Interested friends can follow the editor to learn it.
    2024-02-02
  • c# cast type int method

    This article mainly introduces the C# cast type conversion int method, which has good reference value. I hope it will be helpful to everyone. If there are any errors or no complete considerations, I hope you will be very encouraged.
    2024-07-07
  • Winform development uses common multithreaded base class sharing (in queue form)

    Everyone is familiar with the concept of multithreading. For winform developers, they still use a lot. But they probably use Timer or backgroundWorker. They wrote a multithreaded base class for everyone. Only if you use multithreading, you can use it.
    2013-12-12
  • Detailed explanation of the method of implementing callback function function in C#

    This article mainly introduces the method of implementing callback function functions through delegates in C#. This article gives a typical multi-threaded callback program example. Friends who need it can refer to it.
    2016-04-04
  • Detailed explanation of C# using AD (Active Directory) to verify intranet username and password

    This article mainly introduces detailed information on C#'s use of AD (Active Directory) to verify intranet username and password. I hope this article can help you and enable you to implement such functions. Friends who need it can refer to it.
    2017-10-10
  • C# implements dynamic digital clocks and calendars

    This article mainly introduces the relevant information on C#'s implementation of dynamic digital clocks and calendars in detail. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.
    2022-06-06
  • The easiest way to dynamically read Excel files

    This article shares with you the simplest way to dynamically read Excel files. Readers who need it will refer to it for reference.
    2018-05-05

Latest Comments