close

使用EXCEL內建VBA語言寫出陣列格式

 

Private Sub CommandButton1_Click()
Application.ActiveSheet.Cells(1, 1).Value = "Excel VBA 99乘法表"
For C = 1 To 9
Application.Cells(1, C).ColumnWidth = 3
Next
For I = 1 To 9
For J = 1 To 9
Application.ActiveSheet.Cells(I + 1, J).Value = I * J
Next
Next
End Sub
Private Sub UserForm_Click()
End Sub

 

c#99格

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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
System.Windows.Forms.Button button1;
System.Windows.Forms.Button[] buttons;
Button[,] button = new Button[9, 9];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
button[i, j] = new Button();
button[i, j].Location = new Point(i * 20, j * 20);
this.Controls.Add(button[i, j]);
}
}
}
}
}

arrow
arrow
    全站熱搜

    D0037134 發表在 痞客邦 留言(0) 人氣()