Click here to Skip to main content
15,912,665 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: ColumnHeader Icons Pin
Pablo.ar22-Jul-04 19:01
Pablo.ar22-Jul-04 19:01 
GeneralPrint Dialog Print to file Pin
gthompson200521-Jul-04 15:43
gthompson200521-Jul-04 15:43 
GeneralRe: Print Dialog Print to file Pin
Dave Kreskowiak22-Jul-04 3:51
mveDave Kreskowiak22-Jul-04 3:51 
GeneralDisplay computer IP Pin
GaryKoh21-Jul-04 14:51
GaryKoh21-Jul-04 14:51 
GeneralRe: Display computer IP Pin
Dave Kreskowiak22-Jul-04 4:03
mveDave Kreskowiak22-Jul-04 4:03 
GeneralVba6 and com server Pin
Anonymous21-Jul-04 7:14
Anonymous21-Jul-04 7:14 
GeneralLosing 1/2 my data in System.Collections.Queues .. Pin
inyoursadachine21-Jul-04 6:09
inyoursadachine21-Jul-04 6:09 
GeneralProblem Accessing Dynamically Created Control In Vb.net Pin
mdrash21-Jul-04 3:36
mdrash21-Jul-04 3:36 
Hi,
I have some Problem Accessing dynamically created controls in VB.Net. Actually what I have to do is
I have to get different set of questiond based on the order type.
For example , OrderType A may have 5 questions . It can be a short text, Long Text or a multiple choice question and
OrderType B may have 3 questions of different Type.
I have to create different control(textbox, multi line textbox, radioButton) based on the que type.
I am adding all the controls to a table and the table to a placeholder.
I don't have any problem creating the questions and controls dynamically.
But the problem bubble up when i try to access the dynamically created control.
I am creating the control in the Page_Init
and I am trying to get the response from those dynamically created control once the user click on the submit button.
Here is the code:
PrivateSub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Init
Dim mytable AsNew Table
Dim que As DataTable
Dim qrow As DataRow
Dim row AsInteger
IfNot IsPostBack Then
Dim myorderid = CInt(1)
Dim myaccount As DNS.OrdersDB = New DNS.OrdersDB
myserviceid = myaccount.GetServiceType(myorderid)
que = New DataTable
que = DNS.QADB.GetQuestions(myserviceid).Tables(0)
row = CInt(que.Rows.Count)
Dim i AsInteger
For i = 0 To row - 1
qrow = que.Rows(i)
Dim mytype AsString = qrow("QueType")
Dim myreq AsString = qrow("QueRequired")
If mytype = "SHORT TEXT" Then
Dim myrow AsNew TableRow
Dim myrow1 AsNew TableRow
Dim mycell AsNew TableCell
Dim mycell1 AsNew TableCell
Dim lbl As Label = New Label
lbl.Text = qrow("QueName")
Dim mylblid AsString = "lbl" + CStr(qrow("Queid"))
lbl.ID = mylblid
Dim txt As TextBox = New TextBox
txt.ID = qrow("Queid").ToString()
txt.Width = Unit.Pixel(Convert.ToInt32(200).ToString())
mycell.Controls.Add(lbl)
mycell1.Controls.Add(txt)
myrow.Cells.Add(mycell)
myrow1.Cells.Add(mycell1)
mytable.Rows.Add(myrow)
mytable.Rows.Add(myrow1)
ElseIf (mytype = "LONG TEXT") Then
' as added above
End If
Next
myplace.Controls.Add(mytable)
EndIf
EndSub

Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim mytable As New Table
Dim que As DataTable
Dim qrow As DataRow
Dim row As Integer
Dim myorderid = CInt(1)
Dim myaccount As DNS.OrdersDB = New DNS.OrdersDB
myserviceid = myaccount.GetServiceType(myorderid)
que = New DataTable
que = DNS.QADB.GetQuestions(myserviceid).Tables(0)
row = CInt(que.Rows.Count)
Dim i As Integer
For i = 0 To row - 1
qrow = que.Rows(i)
Dim mytype As String = qrow("QueType")
Dim myreq As String = qrow("QueRequired")
If mytype = "SHORT TEXT" Or mytype = "LONG TEXT" Then
' Trying to get the value of the textbox
Dim c As TextBox = Page.FindControl(qrow("QueId"))
Dim myresponse As String = c.Text
If myreq = "YES" And myresponse = "" Then
lblerr.Text = qrow("QueName")
lblerr.Visible = True
Else
Dim mysystem As DNS.QADB = New DNS.QADB
Dim mystsring As String = mysystem.addQAResponse(qrow("QueId"), myresponse)
End If
End If
Next
End Sub
It's really very urgent. Please someone help me with this. Any Help is greatly appreciated
Thanks

GeneralRe: Problem Accessing Dynamically Created Control In Vb.net Pin
Dave Kreskowiak23-Jul-04 10:31
mveDave Kreskowiak23-Jul-04 10:31 
GeneralDatagrids Pin
Vicetta20-Jul-04 23:35
Vicetta20-Jul-04 23:35 
GeneralRe: Datagrids Pin
Vicetta20-Jul-04 23:39
Vicetta20-Jul-04 23:39 
GeneralRe: Datagrids Pin
Dave Kreskowiak21-Jul-04 7:47
mveDave Kreskowiak21-Jul-04 7:47 
GeneralVBA6 and com server Pin
Anonymous20-Jul-04 12:52
Anonymous20-Jul-04 12:52 
GeneralRe: VBA6 and com server Pin
RichardGrimmer21-Jul-04 1:24
RichardGrimmer21-Jul-04 1:24 
Questionmouse over graphical objects event? Pin
Boniolopez20-Jul-04 11:23
Boniolopez20-Jul-04 11:23 
AnswerRe: mouse over graphical objects event? Pin
Nick Parker20-Jul-04 11:54
protectorNick Parker20-Jul-04 11:54 
GeneralRe: mouse over graphical objects event? Pin
Boniolopez20-Jul-04 14:14
Boniolopez20-Jul-04 14:14 
GeneralInstall my application Pin
Brad Fackrell20-Jul-04 10:02
Brad Fackrell20-Jul-04 10:02 
GeneralRe: Install my application Pin
VenkatFor.NET20-Jul-04 11:28
VenkatFor.NET20-Jul-04 11:28 
GeneralRe: Install my application Pin
Mekong River20-Jul-04 12:08
Mekong River20-Jul-04 12:08 
GeneralRe: Install my application Pin
Brad Fackrell21-Jul-04 4:05
Brad Fackrell21-Jul-04 4:05 
GeneralRe: Install my application Pin
Brad Fackrell25-Jul-04 2:00
Brad Fackrell25-Jul-04 2:00 
QuestionWhat is Pin
KORCARI20-Jul-04 9:08
KORCARI20-Jul-04 9:08 
AnswerRe: What is Pin
VenkatFor.NET20-Jul-04 11:40
VenkatFor.NET20-Jul-04 11:40 
QuestionWhat is the.... Pin
KORCARI20-Jul-04 9:06
KORCARI20-Jul-04 9:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.