日期:2014-05-19  浏览次数:20812 次

寻找用C#及DATAGRID控件开发的WINDOW程序!
希望大虾们能够提供一完整的用c#操作datagrid控件的程序,从基本的数据库的连接,数据绑定,行列的操作等,每种数据库连接最好能提供相应的代码,偶是菜鸟,希望你的代码能给予相应的注解,谢谢,高分相送!

------解决方案--------------------
http://msdn2.microsoft.com/zh-cn/library/1x64c23x(VS.80).aspx
------解决方案--------------------
加我QQ:332492721
------解决方案--------------------
用C#及DATAGRID控件开发的是WEBFORM
用C#及DATAGRIDVIEW控件开发的是WINFORM程序
------解决方案--------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

public class ProgrammaticSizing : System.Windows.Forms.Form
{
private FlowLayoutPanel flowLayoutPanel1;
private Button button1 = new Button();
private Button button2 = new Button();
private Button button3 = new Button();
private Button button4 = new Button();
private Button button5 = new Button();
private Button button6 = new Button();
private Button button7 = new Button();
private Button button8 = new Button();
private Button button9 = new Button();
private Button button10 = new Button();
private Button button11 = new Button();

public ProgrammaticSizing()
{
InitializeComponent();
AddDirections();
this.Load += new EventHandler(InitializeDataGridView);

AddButton(button1, "Reset ",
new EventHandler(ResetToDisorder));
AddButton(button2, "Change Column 3 Header ",
new EventHandler(ChangeColumn3Header));
AddButton(button3, "Change Meatloaf Recipe ",
new EventHandler(ChangeMeatloafRecipe));
AddButton(button10, "Change Restaurant 2 ",
new EventHandler(ChangeRestaurant));
AddButtonsForProgrammaticResizing();
}

#region form code
private void InitializeComponent()
{
this.flowLayoutPanel1 = new FlowLayoutPanel();
this.flowLayoutPanel1.FlowDirection
= FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new Point(492, 0);
this.flowLayoutPanel1.AutoSize = true;

this.AutoSize = true;
this.Controls.Add(this.flowLayoutPanel1);
this.Text = this.GetType().Name;
}

private void AddDirections()
{
Label directions = new Label();
directions.AutoSize = true;
String newLine = Environment.NewLine;
directions.Text = "Press the buttons that start " + newLine
+ "with 'Change ' to see how different sizing " + newLine
+ "modes deal with content changes. ";

flowLayoutPanel1.Controls.Add(directions);
}
#endregion

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new ProgrammaticSizing());
}

private Size startingSize;
private string thirdColumnHeader = "Main Ingredients ";
private string boringMeatloaf = "ground beef ";
private string boringMeatloafRanking = "* ";
private bool boringRecipe;
private bool shortMode;
private DataGridView dataGridView1;
private string otherRestaurant = "Gomes 's Saharan Sushi ";

private void InitializeDataGridView(Object sender