110,528
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using datagridview1.DataSet1TableAdapters;
namespace datagridview1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
CustomersTableAdapter adapter = new CustomersTableAdapter();
bindingSource1.DataSource = adapter.GetData();
dataGridView1.DataSource = bindingSource1;
textBox1.DataBindings.Add("Text", bindingSource1, "CustomerID", true);
textBox2.DataBindings.Add("Text", bindingSource1, "CompanyName", true);
textBox3.DataBindings.Add("Text", bindingSource1, "ContactName", true);
}
}
}