以多种形式使用tabcontrol [英] Using tabcontrol in mult form

查看:76
本文介绍了以多种形式使用tabcontrol的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用tabcontrol显示多种形式,逐个显示一个表格并允许menustrip进行编辑或更新该表格。

基本上一种形式是主要形式,其他形式是辅助表单,它们必须显示在该主表格中,并通过同一主表单上的菜单进行编辑。



这里是我试图制作的代码但是没用。请帮忙。谢谢你

I would like to know how to use tabcontrol to display multiform,to diplay one form by one and to permit menustrip for edit or update for that form.
Basically one form is main and others are secondaries forms, they have to be displayed in that main for and be edited through menus on that same main form.

here are the code I've tried to make but didn't work. please help out. thank u

Imports System.Drawing
Imports System.Windows.Forms
Imports System.Data.OleDb
Public Class LibrarySystemForm
    Dim con As New OleDb.OleDbConnection
    Dim da As OleDb.OleDbDataAdapter
    Dim cmd As OleDbCommand
    Private Sub welcome_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dbprovider As String = "PROVIDER=Microsoft.ACE.OleDb.12.0;"
        Dim dbsource As String = "DATA SOURCE = CUULibDB.mdb.accdb"
        con.ConnectionString = dbprovider & dbsource
        con.Open()


        
    End Sub
    Private Sub MyTabs()
        Me.TabControl1 = New TabControl()
        Me.TabPage1 = New TabPage()
        Me.TabPage2 = New TabPage()

        Me.TabControl1.Controls.AddRange(New Control() {Me.TabPage1, Me.TabPage2})
        Me.TabControl1.Padding = New Point(15, 10)
        Me.TabControl1.Location = New Point(35, 25)
        Me.TabControl1.Size = New Size(220, 220)

        ' Selects tabPage2 using SelectedTab. 
        Me.TabControl1.SelectedTab = TabPage2

        Me.TabPage1.Text = "supplierForm"
        Me.TabPage2.Text = "tabPage2"

        Me.Size = New Size(300, 300)
        Me.Controls.AddRange(New Control() {Me.TabControl1})
    End Sub

    Public Sub tab()
        MyTabs()
    End Sub

    Shared Sub Main()
        Application.Run(New supplierForm())

    End Sub

    Private Sub ToolStripContainer1_ContentPanel_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripContainer1.ContentPanel.Load

    End Sub

    Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked

    End Sub
End Class

推荐答案

我建​​议你使用SearchBox(在右上角)这个窗口的一角)。你会发现很多例子。其中一些我在这里列出给你:

选项卡式MDI儿童表格 [ ^ ]

创建选项卡式MDI表 [ ^ ]

< a href =http://www.codeproject.com/Articles/16436/A-highly-configurable-MDI-tab-control-from-scratch>从头开始的高度可配置的MDI选项卡控件 [ ^ ]

表格作为标签 [ ^ ]

一个简单的标签式MDI [ ^ ]

使用ToolStrip Easy Tabbed Mdi界面 [ ^ ]

WPF中的选项卡式MDI [< a href =http://www.codeproject.com/Articles/32362/Tabbed-MDI-in-WPFtarget =_ blanktitle =New Window> ^ ]



启动是否足够?
I would recommend you to use SearchBox (at the right-top corner of this window). There you'll find many examples. Some of them i've listed for you here:
Tabbed MDI Child Forms[^]
Creating Tabbed MDI Form[^]
A highly configurable MDI tab control from scratch[^]
Form as Tab[^]
A Simple Tabbed MDI[^]
Easy Tabbed Mdi Interface Using the ToolStrip[^]
Tabbed MDI in WPF[^]

Is it enough for start?


这篇关于以多种形式使用tabcontrol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆