private void btnField_Click(object sender, EventArgs e) { nf = new frmNewField(); nf.Owner = this; nf.FormClosed += Nf_FormClosed; nf.Show(); }
private void Nt_FormClosed(object sender, FormClosedEventArgs e) { nt = null; if (lblCurrentTable.Text != null) { primary = false; frmMain fm = ((frmMain)(this.Owner)); myTB = myDB.CreateTableDef(lblCurrentTable.Text); nf = new frmNewField(); nf.Owner = this; nf.FormClosed += Nf_FormClosed; nf.Show(); } }
private void save_new_field() { ListViewItem to_add; string datatype = ""; string index = ""; nf = null; MessageBox.Show(fieldtype + " is the datatype"); switch (fieldtype) { case 0: myFL = myTB.CreateField(Field_Name, DataTypeEnum.dbText, 100); datatype = "Text"; myTB.Fields.Append(myFL); break; case 1: myFL = myTB.CreateField(Field_Name, DataTypeEnum.dbLong); datatype = "Number"; myTB.Fields.Append(myFL); break; case 2: myFL = myTB.CreateField(Field_Name, DataTypeEnum.dbDate); datatype = "DateTime"; myTB.Fields.Append(myFL); break; case 3: myFL = myTB.CreateField(Field_Name, DataTypeEnum.dbCurrency); datatype = "Currency"; myTB.Fields.Append(myFL); break; case 4: myFL = myTB.CreateField(Field_Name, DataTypeEnum.dbBoolean); datatype = "YesNo"; myTB.Fields.Append(myFL); break; case 5: myFL = myTB.CreateField(Field_Name, DataTypeEnum.dbLong); datatype = "AutoNumber"; myTB.Fields.Append(myFL); myFL.Attributes = (int)FieldAttributeEnum.dbAutoIncrField; break; } if (!primary) { if (MessageBox.Show("Is this primary key?", "Index", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Index myInd = myTB.CreateIndex("PrimaryKey"); myFL = myInd.CreateField(Field_Name); ((IndexFields)myInd.Fields).Append(myFL); myInd.Primary = true; myTB.Indexes.Append(myInd); index = "Primary"; primary = true; } } to_add = new ListViewItem(index); to_add.SubItems.Add(Field_Name); to_add.SubItems.Add(datatype); lstview_current_table.Items.Add(to_add); }