VB.Net - Tab Pages with Controls
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: VB.Net - Tab Pages with Controls

  1. #1
    Join Date
    Apr 2013
    Posts
    3

    VB.Net - Tab Pages with Controls

    Sir,
    I beginner for VB.Net programming,
    MS-Access is my DataBase, According to database single person has Few Rows. That mean when their repeat comes new row (record) will be added.
    In Repeat Table of database has Few Fields like "PerID", "Repeat Times", "Company", "Date"

    I need create Tab Pages to equal of repeat times and insert other Details into that Tab Page.

    I code like this and its creates Tab Pages equal to repeat time. If person comes repeatedly 04 times Tab Control will added 04 New pages into Tab Control.

    Code:
    Dim newPageAA As New TabPage()
              Dim RecCount As Integer
    
                While QReaderQ.Read()
                    RecCount = RecCount + 1 ' Count How many Rows
                End While
    
                TabControl1.TabPages.Clear()
    
                For xXx = 1 To RecCount 
                    newPageAA = New TabPage   'create new instance
    
                    If xXx = 1 Then
                        newPageAA.Text = "Repeat - 1"
                    Else
                        newPageAA.Text = "Repeat - " & xXx.ToString
                    End If
                    TabControl1.TabPages.Add(newPageAA)
                Next
    Now I want to put other details ("PerID", "Repeat Times", "Company", "Date") into Tab Pages with Text Boxes or Labels.
    In 1st Tab page -----> I want to see 1st repeat time "PerID", "Repeat Times", "Company", "Date"
    In 4th Tab page -----> I want to see 4th repeat time "PerID", "Repeat Times", "Company", "Date" .......
    Please tell me, how to do this..
    I not asking full code, but show me with little example code, because I am beginner for VB.Net.

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,990

    Re: VB.Net - Tab Pages with Controls

    Code:
            tabPage1.Text = "tabPage1"
            tabPage1.Size = New System.Drawing.Size(256, 214)
            tabPage1.TabIndex = 0
            tab2CheckBox3.Location = New System.Drawing.Point(32, 136)
            tab2CheckBox3.Text = "checkBox3"
            tab2CheckBox3.Size = New System.Drawing.Size(176, 32)
            tab2CheckBox3.TabIndex = 2
            tab2CheckBox3.Visible = True
            tab3RadioButton2.Location = New System.Drawing.Point(40, 72)
    from: http://msdn.microsoft.com/en-us/libr...code-snippet-1
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2013
    Posts
    3

    Re: VB.Net - Tab Pages with Controls

    Sir,
    Thank you for your reply.

    In my task, Before debug, We don't know how many rows belong to each person.
    because of that, I think declare the textboxes or labels with array types. Is it possible ?

    From my code, RecCount given how many record for each person.
    After Create Tab Pages according to RecCount Value.

    My problem is:
    1. When after creation of Tab Pages How I add controls (TextBox or Label) to new Tab Page. (It depend on RecCount) ---I think we should use Loop to do this until RecCount

    2. How I put Record details (example "PerID", "Company" ) into that TextBox or Labels.
    From 1st row of Database to 1st Tab Page
    From 2nd row of Database to 2nd Tab Page

    I attached Tab Control Screen print for Your convenience.
    (It shows How Many Records for selected person.)

    Please Explain me How to do this 1 and 2 questions
    Attachment 31351

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,990

    Re: VB.Net - Tab Pages with Controls

    not a valid link (or picture)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Apr 2013
    Posts
    3

    Re: VB.Net - Tab Pages with Controls

    Name:  Database.jpg
Views: 226
Size:  64.5 KB
    Name:  Tab.jpg
Views: 227
Size:  44.5 KB
    Is it correct,
    This is My Database. There are 02 tables for it. "Master" data and "Repeat"
    I want to do, when click any Tab page, "Repeat" tables data of selected person must be there, as my second picture.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center