|
-
Sep 6th, 2007, 12:02 AM
#1
Thread Starter
Member
[RESOLVED] [2005] Question in create tabpage with same component
How can i create multiple tabpage with same component?
for example, i had create a listview in tabpage1, how do i copy the listview and put in every tabpage?
-
Sep 6th, 2007, 12:12 AM
#2
Re: [2005] Question in create tabpage with same component
Declare your own class and inherit the TabPage class. In the constructor create a ListView and add it to the page. Now add instances of your class to your TabControl instead of regular TabPages.
-
Sep 6th, 2007, 12:15 AM
#3
Thread Starter
Member
Re: [2005] Question in create tabpage with same component
 Originally Posted by jmcilhinney
Declare your own class and inherit the TabPage class. In the constructor create a ListView and add it to the page. Now add instances of your class to your TabControl instead of regular TabPages.
can provide any source code so i can refer to? sry that i am new to vb 2k5
-
Sep 6th, 2007, 12:45 AM
#4
Re: [2005] Question in create tabpage with same component
vb.net Code:
Public Class TabPageEx
Inherits TabPage
Public Sub New()
Dim lv As New ListView
With lv
'Set properties here.
End With
Me.Controls.Add(lv)
End Sub
End Class
-
Sep 6th, 2007, 02:34 AM
#5
Thread Starter
Member
Re: [2005] Question in create tabpage with same component
thx jmcilhinney, i had use ur way and works well, but why i set the name property ntg has happen? below are the codes:
Code:
Public Class TabPageEx
Inherits TabPage
Public Sub New()
Dim lv As New ListView
Dim clmcode As New ColumnHeader
Dim symbol As New ColumnHeader
symbol.Text = "Symbol"
clmcode.Text = "Code"
With lv
.Name = "hello" <--- the name did not display
.BorderStyle = System.Windows.Forms.BorderStyle.None
.MultiSelect = True
.Columns.AddRange(New ColumnHeader() {clmcode, symbol})
.Dock = System.Windows.Forms.DockStyle.Fill
.FullRowSelect = True
.GridLines = True
.View = System.Windows.Forms.View.Details
End With
Me.Controls.Add(lv)
End Sub
End Class
-
Sep 6th, 2007, 03:03 AM
#6
Re: [2005] Question in create tabpage with same component
The Name property of a control is not displayed. It's a way to identify a control within a form's Controls collection. Always read the documentation first. If you use a member and it doesn't work then read its help file to make sure you're using it properly before doing anything else. RTFM applies to software developers more than most, because if we don't read help files then how can we expect the users of our software to do so.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|