DataGirdView数据回填的小例子
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“webShoppingDataSet.petType”中。您可以根据需要移动或移除它。
this.petTypeTableAdapter.Fill(this.webShoppingDataSet.petType);
}
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
{
this.textBox1.Text=this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
}
}
}