Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2009, 04:51 AM
Authorized User
 
Join Date: Feb 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default Dynamic Add User Control Object To The Tab Control

Anyone can suggest what's wrong to the code below as the User Control objects ONLY appear in the first tab and NOT in the balance tabs ?

1) User Control name - usRFQDetail
2) Tab Control name - tcRFQDetail


Quote:
Dim tcPage As New TabPage
Dim ucRFQDetailInstance As usRFQDetail() = New usRFQDetail(100) {}

Dim sdrReader As SqlDataReader = cmdReader.ExecuteReader(CommandBehavior.CloseConne ction)

With sdrReader
If .HasRows Then
ucRFQDetailInstance(intTotalTab) = New usRFQDetail
.Read()
tcRFQDetail.TabPages(intCurrentTab).Text = .GetString(.GetOrdinal("DrawingNo"))
While .Read
intCurrentTab += 1
tcPage.Text = .GetString(.GetOrdinal("DrawingNo"))
tcRFQDetail.TabPages.Add(tcPage) tcRFQDetail.TabPages(intCurrentTab).Controls.Add(u cRFQDetailInstance(intCurrentTab))
End While

Last edited by cheer; February 25th, 2009 at 04:53 AM..
 
Old February 25th, 2009, 10:48 PM
Authorized User
 
Join Date: Feb 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I have found the answer at the end. Below are the codes. Share with you all

While .Read
Dim tcPage As New TabPage()
Dim ucRFQDetailInstance As New usRFQDetail()
tcPage.Text = .GetString(.GetOrdinal("DrawingNo"))
tcPage.Controls.Add(ucRFQDetailInstance)
tcRFQDetail.TabPages.Add(tcPage)
With ucRFQDetailInstance
.Dock = DockStyle.Fill
End With
intCurrentTab += 1
End While





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Dynamic User Control Prabhakar_dt ASP.NET 2.0 Professional 1 June 6th, 2007 07:30 AM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
User Control: Tab key does not work alhad VB.NET 2002/2003 Basics 0 November 3rd, 2005 03:20 AM
Dynamic user control problem sandeep General .NET 0 September 26th, 2005 09:42 AM
Add Dynamic Control HELP HELP jimmyfrank Access VBA 1 January 26th, 2005 06:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.