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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
Form2 newform;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
newform = new Form2();
newform.Show();
}
}
}
------------------------------------------------------------------------------------
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 WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i, j;
int sum = 0;
int[,] arr1 = new int[10, 10];
for (i = 1; i <= 9; i++)
{
for (j = 1; j <= 9; j++)
{
sum = i * j;
arr1[i, j] = sum;
}
}
for (i = 1; i <= 9; i++)
{
for (j = 1; j <= 9; j++)
{
listBox1.Items.Add("i=" + i + ",j=" + j + ",i*j=" + arr1[i, j]);
}
}
}
}
}
沒有留言:
張貼留言