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 My_DataGridView
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Int16 M, N;
- double Sum;
- M = Convert.ToInt16(numericUpDown1.Value);
- N = Convert.ToInt16(numericUpDown2.Value);
- Sum = 0;
- for (int i = 0; i < M; i++)
- for (int j = 0; j < N; j++)
- {
- Sum = Sum + Convert.ToDouble(dataGridView1.Rows[i].Cells[j].Value);
- }
- textBox1.Text = Convert.ToString(Sum);
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Int16 M, N;
- M = Convert.ToInt16(numericUpDown1.Value);
- N = Convert.ToInt16(numericUpDown2.Value);
- for (int i = 0; i < M; i++)
- for (int j = 0; j < N; j++)
- {
- dataGridView1.Rows[i].Cells[j].Value=" ";
- }
- textBox1.Text =" ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement