Click here to Skip to main content
15,891,136 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VB.NET SerialPort.... Pin
Mr. J21-Jun-08 1:31
Mr. J21-Jun-08 1:31 
GeneralRe: VB.NET SerialPort.... Pin
Mr. J21-Jun-08 2:13
Mr. J21-Jun-08 2:13 
QuestionStrange Error While calling SP for storing Datetime. Pin
hariram2820-Jun-08 8:44
hariram2820-Jun-08 8:44 
AnswerRe: Strange Error While calling SP for storing Datetime. DUPLICATE POST - IGNORE Pin
Ashfield20-Jun-08 9:00
Ashfield20-Jun-08 9:00 
QuestionCalling an IP address? Pin
rudemusik20-Jun-08 8:01
rudemusik20-Jun-08 8:01 
AnswerRe: Calling an IP address? Pin
Eduard Keilholz21-Jun-08 7:44
Eduard Keilholz21-Jun-08 7:44 
GeneralRe: Calling an IP address? Pin
rudemusik22-Jun-08 11:25
rudemusik22-Jun-08 11:25 
QuestionDynamic Controls in asp.net Pin
Balram Watwani20-Jun-08 7:42
Balram Watwani20-Jun-08 7:42 
Anybody can help me please!

I have a asp.net page (vb) where I need to create Dynamic Controls. the situation is as follow

I have two links one is inside the panel (add range) and other is outside the panel (add component).
when I click the addrange then the four text boxes are going to add in the panel and when I click on addcomponent then one panel with dropdown box is going to create on the page. I done it but when I click the addcomponent the panel is adding on the page but the boxes on the first panel comes down with the 2nd added panel and first panel does not contain addrange text boxes. I am using webcontrol files. AddRange.ascx and AddComponent.ascx. my code is as follwo.

-----Add Panel----


'Add Panel (component)
Private Sub AddAndRemovePanel()
Dim c As Control = GetPostBackControl(Page)
If Not IsNothing(c) Then
If c.ID.ToString = "btnAddComponent" Then

ltlCountH2.Text = Convert.ToInt16(ltlCountH2.Text) + 1
End If
End If

PH2.Controls.Clear()
Dim ControlID As Integer = 0
For i As Integer = 0 To (Convert.ToInt16(ltlCountH2.Text) - 1)
Dim DynamicUserControl As AddComponent = LoadControl("AddComponent.ascx")
While InDeletedList1("uc1" & ControlID) = True
ControlID += 1
End While
DynamicUserControl.ID = "uc1" & ControlID
AddHandler DynamicUserControl.RemoveUserControl1, AddressOf Me.HandleRemoveUserControl1
AddHandler DynamicUserControl.SelectComponent, AddressOf Me.handleSelectComponent
PH2.Controls.Add(DynamicUserControl)
ControlID += 1
Next
populateADDComponentDropDown()

' MsgBox(ltlCountH3.Text)
' MsgBox("ltlCountH3=" & ltlCountH3.Text)
' MsgBox("ltlCountH1=" & ltlCountH1.Text)
' MsgBox("ltlCountH2=" & ltlCountH2.Text)

End Sub

Private Function InDeletedList1(ByVal ControlID As String) As Boolean
Dim DeletedList() As String = ltlRemovedH2.Text.Split("|")
For i As Integer = 0 To DeletedList.GetLength(0) - 1
If ControlID.ToLower = DeletedList(i).ToLower Then
Return True
End If
Next
Return False
End Function
Sub HandleRemoveUserControl1(ByVal sender As Object, ByVal e As EventArgs)
Dim DynamicUserControl As AddComponent = sender.parent
PH2.Controls.Remove(sender.parent)
ltlRemovedH2.Text &= DynamicUserControl.ID & "|"
ltlCountH2.Text = Convert.ToInt16(ltlCountH2.Text) - 1

End Sub



--------AddRange-------------


'Add Range in Panel
Private Sub AddAndRemoveDynamicControls2()
Dim c As Control = GetPostBackControl(Page)
If Not IsNothing(c) Then
If c.ID.ToString = "btnAddRange" Then
ltlCountH3.Text = Convert.ToInt16(ltlCountH3.Text) + 1
End If
End If

'PH3.Controls.Clear()
Dim ControlID As Integer = 0
For i As Integer = 0 To (Convert.ToInt16(ltlCountH3.Text) - 1)
Dim DynamicUserControl As WebUserControl = LoadControl("AddRange.ascx")

While InDeletedList("uc3" & ControlID) = True
ControlID += 1
End While
DynamicUserControl.ID = "uc3" & ControlID

AddHandler DynamicUserControl.RemoveUserControl, AddressOf Me.HandleRemoveUserControl2

For Each c2 As Control In PH2.Controls

If c2.GetType.Name.ToLower = "addcomponent_ascx" Then
Dim uc As UserControl = CType(c2, UserControl)
Dim mypanel As Panel = uc.FindControl("panel1")
mypanel.Controls.Add(DynamicUserControl)
Else
MsgBox("not found")
End If
Next

'PH2.Controls.Add(DynamicUserControl)
ControlID += 1
Next

End Sub
Private Function InDeletedList2(ByVal ControlID As String) As Boolean
Dim DeletedList() As String = ltlRemovedH3.Text.Split("|")
For i As Integer = 0 To DeletedList.GetLength(0) - 1
If ControlID.ToLower = DeletedList(i).ToLower Then
Return True
End If
Next
Return False
End Function
Sub HandleRemoveUserControl2(ByVal sender As Object, ByVal e As EventArgs)
Dim DynamicUserControl As WebUserControl = sender.parent
PH3.Controls.Remove(sender.parent)
ltlRemovedH3.Text &= DynamicUserControl.ID & "|"
ltlCountH3.Text = Convert.ToInt16(ltlCountH3.Text) - 1
End Sub
AnswerRe: Dynamic Controls in asp.net Pin
Christian Graus20-Jun-08 21:20
protectorChristian Graus20-Jun-08 21:20 
Questionhow can i use my datagridview's combobox Pin
Nika Asgari20-Jun-08 5:56
Nika Asgari20-Jun-08 5:56 
AnswerRe: how can i use my datagridview's combobox Pin
Jay Royall20-Jun-08 6:05
Jay Royall20-Jun-08 6:05 
QuestionDisable the controls in a form... Pin
Sebastian T Xavier20-Jun-08 4:22
Sebastian T Xavier20-Jun-08 4:22 
AnswerRe: Disable the controls in a form... Pin
Eduard Keilholz20-Jun-08 4:54
Eduard Keilholz20-Jun-08 4:54 
GeneralRe: Disable the controls in a form... Pin
Sebastian T Xavier20-Jun-08 5:32
Sebastian T Xavier20-Jun-08 5:32 
GeneralRe: Disable the controls in a form... Pin
MarkB77720-Jun-08 19:42
MarkB77720-Jun-08 19:42 
AnswerRe: Disable the controls in a form... Pin
Jay Royall20-Jun-08 5:28
Jay Royall20-Jun-08 5:28 
QuestionTransparent Form and windows media player Pin
divyesh143220-Jun-08 1:24
divyesh143220-Jun-08 1:24 
AnswerRe: Transparent Form and windows media player Pin
nogChoco22-Jun-08 5:35
nogChoco22-Jun-08 5:35 
QuestionDataGridView to Xml Pin
Anoop Brijmohun19-Jun-08 23:39
Anoop Brijmohun19-Jun-08 23:39 
AnswerRe: DataGridView to Xml Pin
Ajay.k_Singh20-Jun-08 3:19
Ajay.k_Singh20-Jun-08 3:19 
GeneralRe: DataGridView to Xml Pin
Anoop Brijmohun20-Jun-08 3:27
Anoop Brijmohun20-Jun-08 3:27 
QuestionSubClassing Word2007 Fluent Ribbon... Pin
S2Coder19-Jun-08 23:18
S2Coder19-Jun-08 23:18 
QuestionAdding data in a combo box from the database Pin
Aigini19-Jun-08 21:27
Aigini19-Jun-08 21:27 
AnswerRe: Adding data in a combo box from the database Pin
Christian Graus19-Jun-08 21:43
protectorChristian Graus19-Jun-08 21:43 
Questioncalling exe Pin
kadkir19-Jun-08 20:20
kadkir19-Jun-08 20:20 

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.