質問を理解していないことを認めなければなりませんが、DataTable を作成する 1 つの方法を次に示します。
DataTable table = new DataTable();
table.Columns.Add("StudentID", typeof(int));
table.Columns.Add("StudenName", typeof(string));
table.Columns.Add("Passed", typeof(bool));
int studentID = int.Parse(txtStudentID.Text);
String studentName = txtStudentName.Text;
bool passed = ckbxPF.SelectedIndex == 0; // assuming that "passed" is the first item
table.Rows.Add(studentID, studentName, passed);
DataTable
たとえば、クラスのメソッドから返すか、またはそのクラスへの参照がある場合は、プロパティを介してこれを渡すことができます。次に例を示します。
// somewhere in Class2
DataTable table = class1.Table;
//in Class1, initialize this table from where you want
public DataTable Table { get; set;}