如何在一个具有菜单的表单中显示多个表单 [英] How to display multi forms in one form that has menus
本文介绍了如何在一个具有菜单的表单中显示多个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用vbnet和访问开发一个项目,但我不知道如何链接多个表单以及如何使它们嵌入一个具有菜单进行更改的表单中。
请帮助我知道如何将这些表格嵌入其中。
I was developing a project using vbnet and access but I fail to know how I can link multiple form and how I can make them work embedded in one form that has menus to make changes.
Please help know how I can embed those forms to display in one.
' this is form that will display the every form to be updated
Public Class LibrarySystemForm
Private Sub welcome_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub BookFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BookFormToolStripMenuItem.Click
bookForm.Show()
End Sub
Private Sub AmountFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AmountFormToolStripMenuItem.Click
amountForm.Show()
End Sub
Private Sub SupplierFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SupplierFormToolStripMenuItem.Click
supplierForm.Show()
End Sub
Private Sub ReservationFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReservationFormToolStripMenuItem.Click
reservationForm.Show()
End Sub
Private Sub ReturnFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReturnFormToolStripMenuItem.Click
returnForm.Show()
End Sub
Private Sub UserdetailFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserdetailFormToolStripMenuItem.Click
user_detailForm.Show()
End Sub
Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked
End Sub
Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked
End Sub
Private Sub ToolStripContainer1_ContentPanel_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripContainer1.ContentPanel.Load, ContentPanel.Load
bookForm.Show()
End Sub
End Class
' this the code of one of the form that has to be embed in the form that has menus to be edited
Public Class supplierForm
Private Sub SuppliersBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.SuppliersBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me._CUULibDB_mdbDataSet3)
End Sub
Private Sub SuppliersBindingNavigatorSaveItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SuppliersBindingNavigatorSaveItem.Click
Me.Validate()
Me.SuppliersBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me._CUULibDB_mdbDataSet3)
End Sub
Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the '_CUULibDB_mdbDataSet3.suppliers' table. You can move, or remove it, as needed.
Me.SuppliersTableAdapter.Fill(Me._CUULibDB_mdbDataSet3.suppliers)
End Sub
End Class
我想收到某人的电子邮件,以便我可以向他或她发送整个项目以查看它。谢谢你
I would like to get someone's email so that I may send to him or her the whole project to have look on it. thank u
推荐答案
您可以在主窗体上使用面板或选项卡控件。最好使用主窗体上的Tabcontrol例如在主窗体上添加一个
Tabcontrol。
然后在菜单中点击。我在TabControl中添加了默认的一个标签页,其余的标签页将是单击菜单生成。
Hi,
You can use panel or Tab Control on your Main form.Best is go with Tabcontrol on your main form.for example add a
Tabcontrol on your main form.
then in menu click.here i have default one tab page added in TabControl ,rest of the Tab Pages will be generated on menu click.
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.TopLevel = false;
frm.Visible = true;
frm.FormBorderStyle = FormBorderStyle.None;
frm.Dock = DockStyle.Fill;
tabControl1.TabPages[0].Controls.Add(frm);
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
Form3 frm = new Form3();
frm.TopLevel = false;
frm.Visible = true;
frm.FormBorderStyle = FormBorderStyle.None;
frm.Dock = DockStyle.Fill;
if (tabControl1.TabPages.Count > 1)
{
tabControl1.TabPages[0].Controls.Add(frm);
}
else
{
tabControl1.TabPages.Add("Secont Tab");
tabControl1.TabPages[1].Controls.Add(frm);
}
}
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
Form3 frm = new Form3();
frm.TopLevel = false;
frm.Visible = true;
frm.FormBorderStyle = FormBorderStyle.None;
frm.Dock = DockStyle.Fill;
if (tabControl1.TabPages.Count > 1)
{
tabControl1.TabPages[0].Controls.Add(frm);
}
else
{
tabControl1.TabPages.Add("Secont Tab");
tabControl1.TabPages[1].Controls.Add(frm);
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
Form4 frm = new Form4();
frm.TopLevel = false;
frm.Visible = true;
frm.FormBorderStyle = FormBorderStyle.None;
frm.Dock = DockStyle.Fill;
if (tabControl1.TabPages.Count > 2)
{
tabControl1.TabPages[2].Controls.Add(frm);
}
else
{
tabControl1.TabPages.Add("Third Tab");
tabControl1.TabPages[2].Controls.Add(frm);
}
}
这篇关于如何在一个具有菜单的表单中显示多个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文