Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2003, 02:48 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB 6: Coolbar Dropdown Button Code

I am having trouble finding code that will show me how to
programatically add a series of buttons to a dropdown button. I want
to recreate something like the first button at the top left of the VB
6 application, that lets you choose the type of project that you want
to build. I can actually get the button to show the dropdown arrow but
I can't add more buttons under it. Here's a code snippit:

'Dim btnVar As Button
Dim lsiVar As ListImage

'The following line may help to locate the bitmaps
ChDir App.Path

' Load the Pics
Load Me.tbrMain(1)
Set lsiVar = Me.imlMain(0).ListImages.Add(1, , LoadPicture("New.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(2, ,
LoadPicture("Open.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(3, ,
LoadPicture("Save.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(4, ,
LoadPicture("Print.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(5, , LoadPicture("Cut.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(6, ,
LoadPicture("Copy.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(7, ,
LoadPicture("Paste.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(8, ,
LoadPicture("Delete.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(9, ,
LoadPicture("Execute.ico"))
Set lsiVar = Me.imlMain(0).ListImages.Add(10, ,
LoadPicture("Nethood.ico"))
Set lsiVar = Me.imlMain(0).ListImages.Add(11, ,
LoadPicture("Excel.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(12, ,
LoadPicture("Directory.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(13, ,
LoadPicture("Document.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(14, ,
LoadPicture("CSV.bmp"))
Set lsiVar = Me.imlMain(0).ListImages.Add(15, , LoadPicture("IE.bmp"))

Me.tbrMain(0).Align = vbAlignTop
Me.tbrMain(0).Appearance = ccFlat
Me.tbrMain(0).BorderStyle = ccNone
Me.tbrMain(0).Style = tbrFlat

' Must all be consecutive numbers!!!!
Set Me.tbrMain(0).ImageList = Me.imlMain(0)
Set btnVar = Me.tbrMain(0).Buttons.Add(1, , , , 1)
btnVar.ToolTipText = "New SQL Script"
Set btnVar = Me.tbrMain(0).Buttons.Add(2, , , , 2)
btnVar.ToolTipText = "Open SQL Script"
Set btnVar = Me.tbrMain(0).Buttons.Add(3, , , , 3)
btnVar.ToolTipText = "Save SQL Script"
Set btnVar = Me.tbrMain(0).Buttons.Add(4, , , , 4)
btnVar.ToolTipText = "Print"
Set btnVar = Me.tbrMain(0).Buttons.Add(5, , , , 5)
btnVar.ToolTipText = "Cut"
Set btnVar = Me.tbrMain(0).Buttons.Add(6, , , , 6)
btnVar.ToolTipText = "Copy"
Set btnVar = Me.tbrMain(0).Buttons.Add(7, , , , 7)
btnVar.ToolTipText = "Paste"

Me.tbrMain(1).Align = vbAlignTop
Me.tbrMain(1).Appearance = ccFlat
Me.tbrMain(1).BorderStyle = ccNone
Me.tbrMain(1).Style = tbrFlat

Set Me.tbrMain(1).ImageList = Me.imlMain(0)

Set btnVar = Me.tbrMain(1).Buttons.Add(1, , , , 9)
btnVar.ToolTipText = "Execute SQL"
Set btnVar = Me.tbrMain(1).Buttons.Add(2, , , , 8)
btnVar.ToolTipText = "Clear SQL"
Set btnVar = Me.tbrMain(1).Buttons.Add(3, , , , 10)
btnVar.ToolTipText = "Change Connection"

' *** This bit is the button that has the drop down (Style=5 is the
4th element) ***
Set btnVar = Me.tbrMain(1).Buttons.Add(4, , , 5, 11)
btnVar.ToolTipText = "Excel Export"

Set btnVar = Me.tbrMain(1).Buttons.Add(5, , , , 13)
btnVar.ToolTipText = "Documentation"
Set btnVar = Me.tbrMain(1).Buttons.Add(6, , , , 12)
btnVar.ToolTipText = "Tables and Fields Listing"

' *** I want these buttons to be under the Excel Export button, not on
their own as they are currently ***

Set btnVar = Me.tbrMain(1).Buttons.Add(7, , , , 14)
btnVar.ToolTipText = "CSV Export"

Set btnVar = Me.tbrMain(1).Buttons.Add(8, , , , 15)
btnVar.ToolTipText = "HTML Export"
...Help!

Thanks.

Craig.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Button VB Code taraj Access 16 May 22nd, 2008 10:37 AM
MS Access help - VB Code for command button pari22 Access VBA 11 September 7th, 2007 11:13 AM
How to Click a web button using VB code AJD Access VBA 6 June 6th, 2006 07:32 AM
How to Click a button on a web page in VB code AJD Beginning VB 6 0 June 2nd, 2006 12:08 PM
Button with dropdown in IE toolbar baburman General .NET 1 May 20th, 2005 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.