I am currently working on a project and need to allow the user to create tabs. This I have managed to do although the solution (to copy from another hidden tab).

The problem I have is that I need the tabs being displayed to change between records (something that does not happen).

Is there a way of doing this or even a better solution?

I am using VB.net and SQL 2005.

Thanking you in advance for your assistance.

Recommended Answers

All 8 Replies

That looks like it will help with the creation of the tabs iamthwee and I will try this later.

Does it allow for different tabs for each file?

Member Avatar for iamthwee

What do you mean for each file?

What I mean is that the tabs are going to show details from a SQL table.

The use wants to be able to only show the tabs necessary for the main record shown, so this may need to change as the users goes from record to record.

Does this help/make sense?

Member Avatar for iamthwee

This doesn't really make any sense. I've never personally seen any system designed like that.

DatagridView would be the obvious option for displaying information from a database. All this dynamic tab creation sounds illogical to me?

I quite agree with you, but it is what the person wants.

Is it possible to rename tabs on a regular basis?

Member Avatar for iamthwee

I don't know if this is what you are looking for but:

1. Create a new form and drag a tabControl onto it. Call it TabPage1
2. Create a text box call it TextBox1
3. Create two buttons call it Button1,Button2 respectively.

Paste in the code:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TabControl1.Controls.Add(New TabPage(TextBox1.Text))

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TabControl1.SelectedTab.Text = TextBox1.Text
    End Sub
End Class

Basically it allows you create new tabs on the fly and if you click on a tab and type a name into the text box it renames that tab?

The following link might be of use although I've not looked at it?
http://www.tek-tips.com/viewthread.cfm?qid=1393076&page=1

Thanks once again iamthwee.

I am busy today, but will have a look in details later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.