Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 November 12th, 2003, 12:02 AM
Authorized User
 
Join Date: Nov 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to koneruvijay
Default Dynamic Controls [xx(]



Hello Folks,

       I am adding 4 labels,4 textboxs,4 combos to form dynamically at runtime to a panel.These are added according to selected value in the combobox.But now i want to validate each textbox which added dynamically on the panel.I am unable to identify each textbox.Can u please help me.Here i am giving my sample code.

                Panel1.Visible = True
                Panel1.Controls.Clear()
                Dim ch As String = cmbchoices.SelectedItem.ToString
                Dim i As Integer
                Dim lblsno As Label
                Dim txtanswer As TextBox
                Dim cmbrw As ComboBox
                Dim pos As Integer = 20
                Label4.Visible = True
                Label5.Visible = True
                Panel1.Controls.Add(Label4)
                Panel1.Controls.Add(Label5)
                Label4.Location = New Point(50, 5)
                Label5.Location = New Point(265, 5)
                For i = 1 To CType(ch, Integer)
                    lblsno = New Label()
                    lblsno.Name = "lbl" & i
                    'lblsno.ForeColor = White
                    lblsno.Location = New Point(30, 10 + pos)
                    lblsno.Size = New Size(20, 23)
                    lblsno.Text = i.ToString
                    Panel1.Controls.Add(lblsno)

                    txtanswer = New TextBox()
                    txtanswer.Name = "txt" & i
                    txtanswer.Location = New Point(50, 10 + pos)
                    txtanswer.Size = New Size(200, 23)
                    Panel1.Controls.Add(txtanswer)

                    cmbrw = New ComboBox()
                    cmbrw.Name = "cmb" & i
                    cmbrw.Location = New Point(270, 10 + pos)
                    cmbrw.Size = New Size(100, 23)
                    cmbrw.Items.Add("Right")
                    cmbrw.Items.Add("Wrong")
                    cmbrw.SelectedIndex = 1
                    Panel1.Controls.Add(cmbrw)
                    pos = pos + 30
                    If txtanswer.Text = "" Then
                        ErrorProvider1.SetError(txtanswer, "You Must Enter")
                    Else
                        ErrorProvider1.BlinkStyle = ErrorBlinkStyle.NeverBlink
                    End If

                Next

                Insert.Visible = True

            End If







Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Controls with Database. carumuga Classic ASP Professional 0 February 1st, 2007 12:53 AM
Dynamic Positioning of Controls funnylearning BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 September 22nd, 2006 11:16 AM
can someone help mi ? i m quite a newbie ..[xx(] g0dchild_85 ASP.NET 1.0 and 1.1 Basics 4 June 9th, 2006 12:59 PM
Dynamic Controls tommyuk VB How-To 2 June 26th, 2003 12:54 PM





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