C# implements the method of binding the association between DataGridView and TextBox
This article describes the method of C# to bind the association between DataGridView and TextBox. Share it for your reference. The specific implementation method is as follows:
using System; using ; using ; using ; using ; using ; using ; namespace { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { /* Create a DataSet with 1 DataTable */ DataSet dataSet = new DataSet(); DataTable dataTable = ("Numbers"); ("ID", typeof(int)); ("Name", typeof(string)); (0, "Zero"); (1, "One"); CurrencyManager cm; /* Get a CurrencyManager */ // cm = ([dataSet, "Numbers"] as CurrencyManager); /* This gets a different CurrencyManager */ cm = ([dataTable] as CurrencyManager); /* Bind left DataGridView and TextBox */ this. = dataSet; this. = "Numbers"; this.("Text", dataSet, "", true); /* Bind left DataGridView and TextBox */ this. = dataTable; this.("Text", dataTable, "Name", true); } } }
I hope this article will be helpful to everyone's C# programming.
Related Articles
Unity3d archery mini game implementation example
This article mainly introduces a detailed explanation of the implementation example of Unity3d archery mini game. Friends in need can refer to it for reference. I hope it can be helpful. I wish you more progress and get promoted as soon as possible to get a salary increase.2023-12-12C# and WMI usage tips
C# and WMI usage tips set...2007-03-03C# uses recursive algorithm to solve the problem of Hanoi Tower
This article mainly introduces how C# uses recursive algorithms to solve the classic Hannover problem. The sample code in the article is explained in detail, which is helpful for us to learn C#. If you need it, please refer to it.2022-04-04A brief analysis of generic class interface definition
I encountered many problems in the process of using generics to define classes. The records are as follows. Friends who need it can refer to it.2013-07-07C# implements the pop-up frame in the lower right corner of the system desktop
This article mainly introduces in detail how C# can implement the pop-up box in the lower right corner of the system desktop. The sample code in the article is explained in detail, which is of some help to our learning C#. Interested friends can follow the editor to learn about it.2023-01-01C# operation string method summary example code
This article mainly introduces the example code of C# operation string method. Friends who need it can refer to it.2017-10-10C# Generate Word Recording Instance Analysis
This article mainly introduces the analysis of C# word record instances, which are very practical functions. Friends who need it can refer to it.2014-08-08C# uses interface to realize multilingual selection function
This article mainly introduces in detail how C# uses interface to implement multilingual selection function, that is, multilingual switching function. The sample code in the article is explained in detail. Interested friends can learn about it.2024-02-02An example analysis of method with variable number of parameters in C#
This article mainly introduces the method of variable parameters in C#. It analyzes the method of variable parameters in C# with a simple example. It is mainly implemented using the params keyword. It is a more practical technique in C# programming. Friends who need it can refer to it.2014-11-11Detailed explanation of how C# wpf embeds external programs
After embedding various window controls, there is actually another requirement: embed external programs. Sometimes we may need to embed some existing programs such as a browser or player. Let’s take a look at the specific operation below.2024-04-04