473,325 Members | 2,771 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,325 software developers and data experts.

Toolbar control

Ali Rizwan
925 512MB
Hi all,
I am using a control named toolbar control.

I have added 5 buttons to it
Now i want to add some commands to button 1
when i add code to toolbar click event then it played on every button
but i want to play that code only on button 1 how can i do

Thanx
Dec 4 '07 #1
11 1363
debasisdas
8,127 Expert 4TB
You need to handle the index of the button.
Dec 6 '07 #2
VijaySofist
107 100+
Hi!

In the ToolBar1_Click event use the Select Case statement like

Private Sub ToolBar1_Click()
Select Case ButtonCaption
Case "New"
Call Related Function
Case "Save"
Call Related Function
Else
Call Related Function
End Select
End Sub

With Regards
Vijay. R
Dec 6 '07 #3
debasisdas
8,127 Expert 4TB
Hi!

In the ToolBar1_Click event use the Select Case statement like

Private Sub ToolBar1_Click()
Select Case ButtonCaption
.
.
What if the button has no caption ?
Dec 6 '07 #4
lotus18
866 512MB
What if the button has no caption ?
VijaySofist can use toolbar's index.

Rey Sean
Dec 6 '07 #5
debasisdas
8,127 Expert 4TB
VijaySofist can use toolbar's index.

Rey Sean
Thats what i have suggested in my previous post.
Dec 6 '07 #6
Ali Rizwan
925 512MB
I have tried all these things
Vijay >>> there are no captions on buttons
Debasis >>>> Can u plz give me an example for using index.

Thanx
Dec 7 '07 #7
9815402440
180 100+
hi

when you insert button in the toolbar (by opening properties by right clicking on it), set Key of each button. then use following code


Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
With Toolbar1
Select Case Button.Key
Case "one"
MsgBox "one"
Case "two"
MsgBox "two"
End Select
End With
End Sub

regards
manpreet singh dhillon hoshiarpur
Dec 8 '07 #8
Ali Rizwan
925 512MB
...when you insert button in the toolbar (by opening properties by right clicking on it), set Key ...
Thanks Manpreet
I'll try it and
thanks again.
Dec 9 '07 #9
Killer42
8,435 Expert 8TB
So, did it work?
Dec 12 '07 #10
QVeen72
1,445 Expert 1GB
Hi Ali,

Alternatively, you can check for Button.Index
something like this :

Expand|Select|Wrap|Line Numbers
  1.     Select Case Button.index
  2.         Case 1
  3.             MsgBox "First Button"
  4.         Case 2
  5.             MsgBox "Second Button"
  6.         Case 3
  7.             MsgBox "Third Button"
  8.     End Select
  9.  
Regards
Veena
Dec 12 '07 #11
Ali Rizwan
925 512MB
Thanx to all
Specialy to Veena and Manpreet Singh

Problem Solved

Thanx

>> Ali <<
Dec 12 '07 #12

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

Similar topics

15
by: Code Monkee | last post by:
How can the toolbar and menubar be hidden in IE? When opening the window via javascript I can specify 'toolbar=no,menubar=no', which works fine. However if the window already exists how can I...
1
by: Arif | last post by:
I have a bizarre problem. I am using a code module to update the Caption property of the buttons of a custom toolbar. Though the code module works fine, the new caption does not immediately show on...
7
by: Andy Bates | last post by:
I have hopefully a simple problem in C#. I designed a form with a listview on left, vert splitter against that, then the remainder of the form from top to bottom: a listview, horiz splitter and...
2
by: Sean Dudley | last post by:
I have a toolbar control in my main form. I thread out a an instance of a watcher class (just looking for new processes and raising an event when one arises) as a background thread. my main form...
0
by: I am Sam | last post by:
Ok whats wrong with my toolbar? When I debug I don't get an error message and the databinding is working correctly but the toolbar itself and the <iewc:ToolbarDropDownlist /> control isn't showing...
5
by: Stewart | last post by:
Pressing a Save Button on a Toolbar will not bind or validate the last value entered in a text box. I have found that when clicking on the Toolbar the focus in the binded text box does not leave. ...
6
by: Juan Pedro Gonzalez | last post by:
I wanted to add a Combobox to a toolbar... Kind of the look you get on VisualStudio's toolbar. I've been able to find some VB 6 samples, but the placeholder option is no longer available for...
1
by: Alfredo Barrientos | last post by:
Hi, I have a little trouble trying to assign a Toolbar control to another toolbar variable control. I am getting my forms controls with this: for (int j = 0; j <= frmChild.Controls.Count -...
1
by: mookid8000 | last post by:
Hello again, group! Can someone tell me a nice way to include a zoom percentage combobox in a toolbar? My first try was a workaround, where I inserted a bunch of separators where I wanted the...
0
by: Ryan Liu | last post by:
Hi, I have this inconsistent problem for days and really get me exhausted. I have a user control with a datagrid, a small toolbar, a label and a text box on it. Toolbar has buttons to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.