VB.NET - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

VB.NET

kilojouleskilojoules Posts: 2Member
[b][/b][italic][/italic]
I added a SplitContainer to my form, and put some ComboBoxes in panel1 of the spliter and so many panels in panel2 of the spliter. I wrote some codes that when a user clicks on one of the Items in one of the ComboBoxes, a certain panel in panel2 of the spliter must come to the front. But it does'nt. I want to know if there is a property which enables this, or my codes were wrong? This is how my codes looks like:

Private sub ComboBox1..............
Select Case ComboBox1.SelectedIndex
Case o
Panel.BringToFront
Case 1
Panel2.BringToFront
..
..
..
End Case
End sub

Kind regards
Selby

Comments

  • seancampbellseancampbell Pennsylvania, USAPosts: 684Member ✭✭✭
    It is possible that your code was wrong.

    I wrote a simple program, I added a SplitContainer and added a combo box to panel1 of that control. I added 2 panels to the right side.

    I made sure they overlapped WITHOUT putting on inside the other, which you may have accidentally done (I accidentally did it and had to separate them). I pre-populated some values into the combo box so I had choices to select from. I changed the back color on my Panels so I could see if they were coming to front or not.

    Here is the resulting code:
    [code]

    Public Class Form1
    'Every time you select a new item on Combobox1, it will call this code
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    Select Case ComboBox1.SelectedIndex
    Case 1 'This would be the SECOND ITEM IN THE LIST
    Panel2.BringToFront()
    Case 2 'This would be the THIRD ITEM IN THE LIST
    Panel1.BringToFront()
    End Select
    End Sub
    End Class
    [/code]
Sign In or Register to comment.