jgoodman00
Programmer
- Jan 23, 2001
- 1,510
The following is related to a Mobile .NET application I am experimenting with.
I have a main form, which has the following controls:
2 x Combo boxes.
1 x Command Button
1 x Panel control
I then have two (at this stage but it will increase) other forms. I want to load the forms into the panel on the main form, based on the selection in the combo boxes.
At this stage I am only concerned with the input from one of the Combo boxes. I wrote the following to load the subform into the Panel control:
This works for the first selection, & the correct subform is displayed in the panel:
However, if I then select a second form from the combo, the existing form seems to be maximised:
Any suggestions?
James Goodman MCSE, MCDBA
I have a main form, which has the following controls:
2 x Combo boxes.
1 x Command Button
1 x Panel control
I then have two (at this stage but it will increase) other forms. I want to load the forms into the panel on the main form, based on the selection in the combo boxes.
At this stage I am only concerned with the input from one of the Combo boxes. I wrote the following to load the subform into the Panel control:
Code:
Private Sub cboAssetType_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboAssetType.SelectedValueChanged
Dim i As Integer
For i = 0 To Me.Panel1.Controls.Count - 1
Me.Panel1.Controls.RemoveAt(i)
Next
Select Case Me.cboAssetType.Text
Case "Tree"
Dim frmT As New frmTree
'Load tree form
Panel1.Controls.Add(frmT)
frmT.Show()
Case "Fence"
Dim frmF As New frmFence
'Load fence form
Panel1.Controls.Add(frmF)
frmF.Show()
End Select
End Sub
This works for the first selection, & the correct subform is displayed in the panel:

However, if I then select a second form from the combo, the existing form seems to be maximised:

Any suggestions?
James Goodman MCSE, MCDBA