Add Combo to panel in VB

Oct 5, 2009 at 4:07 AM

Hi,

How do you Add ComboBox to panel in VB?

Thanks.

Jan 4, 2010 at 9:34 AM

this work for me in VB2008 sp1 :

Public Class Form1
    Dim RibbonComboObject As RibbonComboBox
    Dim RibbonComboElementsList As RibbonButtonList
    Dim RibbonComboElements() As RibbonButton


    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        CreateComboBox()
    End Sub

 
    Sub CreateComboBox()
        RibbonComboObject = New RibbonComboBox
        RibbonComboElementsList = New RibbonButtonList
        RibbonComboPanel.Items.Add(RibbonComboObject)
        Dim z As Int32
        While z < 3
            ReDim RibbonComboElements(z)
            RibbonComboElements(z) = New RibbonButton
            RibbonComboObject.DropDownItems.Add(RibbonComboElements(z))
            RibbonComboElements(z).Text = "Element " & z
            RibbonComboElements(z).Tag = z
            AddHandler RibbonComboElements(z).Click, AddressOf RibbonComboElements_Click
            z = z + 1
        End While
    End Sub


    Private Sub RibbonComboElements_Click(ByVal sender As RibbonButton, ByVal e As EventArgs) Handles MyBase.Click
        RibbonComboObject.TextBoxText = sender.Text
    End Sub
End Class




Jan 4, 2010 at 9:57 AM

using the toolbox..

Developer
May 16, 2013 at 12:27 PM
Hi, a new version of Ribbon is released. Please visit the new site for latest fixes, releases, information and downloads.
New site: http://officeribbon.codeplex.com/