Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace DefaultViewTeszt {
- public partial class Form1 : Form {
- private DataTable Table;
- public Form1() {
- InitializeComponent();
- Table = new DataTable();
- Table.Columns.Add("A",typeof(string));
- Table.Columns.Add("B",typeof(string));
- Table.Columns.Add("C", typeof(string));
- }
- private void Form1_Load(object sender, EventArgs e) {
- Table.Rows.Add("A", "A", "A");
- Table.Rows.Add("A", "A", "B");
- Table.Rows.Add("A", "A", "C");
- Table.Rows.Add("A", "B", "A");
- Table.Rows.Add("A", "B", "B");
- Table.Rows.Add("A", "B", "C");
- Table.Rows.Add("A", "C", "A");
- Table.Rows.Add("A", "C", "B");
- Table.Rows.Add("A", "C", "C");
- Table.Rows.Add("B", "A", "A");
- Table.Rows.Add("B", "A", "B");
- Table.Rows.Add("B", "A", "C");
- Table.Rows.Add("B", "B", "A");
- Table.Rows.Add("B", "B", "B");
- Table.Rows.Add("B", "B", "C");
- Table.Rows.Add("B", "C", "A");
- Table.Rows.Add("B", "C", "B");
- Table.Rows.Add("B", "C", "C");
- Table.Rows.Add("C", "A", "A");
- Table.Rows.Add("C", "A", "B");
- Table.Rows.Add("C", "A", "C");
- Table.Rows.Add("C", "B", "A");
- Table.Rows.Add("C", "B", "B");
- Table.Rows.Add("C", "B", "C");
- Table.Rows.Add("C", "C", "A");
- Table.Rows.Add("C", "C", "B");
- Table.Rows.Add("C", "C", "C");
- dataGridView1.DataSource = Table;
- dataGridView1.AutoGenerateColumns = true;
- }
- private void button1_Click(object sender, EventArgs e) {
- Close();
- }
- private void button2_Click(object sender, EventArgs e) {
- if (textBox2.Text=="") {
- Table.DefaultView.RowFilter = "";
- } else {
- Table.DefaultView.RowFilter = string.Format("{0}='{1}'", textBox2.Text, textBox1.Text);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement