473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

A dynamic ribbon dropdown?

I am creating a custom ribbon with a dropdown/combo box, is there anyway of making this dynamic, by basing it on a query?

Thanks in advance,

Nicholas
Sep 20 '11 #1
1 7547
What ever triggers to change your query will change a variable (cmbTDEngGroup in the example code) that can be seen by your ribbon callbacks. Then need to invalidate the control forcing it to reload'

Expand|Select|Wrap|Line Numbers
  1. Public gobjRibbon As IRibbonUI
  2. Dim comboLabels() as string
  3.  
  4. ' Callback Count of items and fills in items into arrays
  5. Sub RibbonCBGetItemCount(control As IRibbonControl, ByRef count)
  6.  
  7.     Dim i As Integer, s As String
  8.     Dim rst_type As Recordset
  9.  
  10.     s = "SELECT DISTINCTROW DC_Desc FROM Drawing_Catagory WHERE  DC_level0 = " & cmbTDEngGroup & " ORDER BY DC_level1;"
  11.     Set rst_type = CurrentDb.OpenRecordset(s, dbOpenForwardOnly)
  12.     i = 0
  13.     ReDim comboLabels(i) ' comboLabels is a dynamic array 
  14.     comboLabels(i).sLabel = ""
  15.     i = 1
  16.     Do Until rst_type.EOF
  17.         ReDim Preserve comboLabels(i)
  18.         comboLabels(i) = rst_type!DC_Desc
  19.         rst_type.Move 1
  20.         i = i + 1
  21.     Loop
  22.     count = i
  23.     rst_type.Close
  24. end sub    
  25.  
  26.  
  27. ' callback to get each item
  28. Sub RibbonGetItemLabel(control As IRibbonControl, Index As Integer, ByRef label)
  29.     Select Case control.id
  30.         Case "cmbComboGroup"
  31.             label = comboLabels(Index).sLabel
  32.         Case Else
  33.     End Select
  34. End Sub
  35.  
Sep 24 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Ganco | last post by:
We have a dropdown combobox, where some of the text is wider than the textarea. I cannot set the width of the SELECT any higher due to design restrictions on the company website. When clicking...
7
by: Jeff Uchtman | last post by:
I know I have done this but my mind is fried. I have a dynamic dropdown in a form. I need to pull both the dynamic dropdown's ID and name listed in the dropdown. Need a little help with grey...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
0
by: premkutuva | last post by:
I have created a run time dropdown control in the serverside ASPX file also, i want to creat event handle for that control also i need to handle the OnItemChange( ) event. in server side aspx file,...
0
by: Bob | last post by:
Hi, Can anyone show me an example of how to populate / update a dropdown ribbon control with new items from VBA. I have created a dropdown on a custom ribbon group with a callback that works...
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
1
by: SunshineInTheRain | last post by:
The following code is dynamic create dropdownmenu which data within pulled from database However, the code work well on IE but not on Firefox. On Firefox, the whole mouseover and mouseout function...
2
by: raamay | last post by:
I want to have a dynamic dropdown box whose entries would depend on the selection of an entry in the first dropdown box. BUT the second dropdown box should not reload, only the entries inside should...
4
by: mainul05 | last post by:
hi, i m newbie php+mysql. in i have the following problem. i tried my best to solve it but could do it. please help me. i have a from where 3 fields are STATE, AREA and SUBRUB. AREA is connected...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.