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

VB6 Is it possible to return the caption of the clicked button??

This is a pretty newbie type of question so please bear with me....

Is it possible to return the caption of the button that you just pushed by using some sort of ME or SELF?? I can't for the life of me figure out how to do this.

Thanks a ton.
Feb 13 '07 #1
1 1147
Killer42
8,435 Expert 8TB
This is a pretty newbie type of question so please bear with me....

Is it possible to return the caption of the button that you just pushed by using some sort of ME or SELF?? I can't for the life of me figure out how to do this.
Not in exactly that way.

But you know which button it was, because it invokes the event procedure for that button. So for example if you wanted to show the caption in a message box, you could do this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.   MsgBox Command1.Caption
  3. End Sub
If it's a member of a control array, then you also need to use the Index which is passed. Like so...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click(Index As Integer)
  2.   MsgBox Command1(Index).Caption
  3. End Sub
P.S. Me refers to the form. So Command1 is the same as Me.Command1.
Feb 13 '07 #2

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

Similar topics

4
by: Mohammed Mazid | last post by:
Can anyone please help me on how to move to the next and previous question? Here is a snippet of my code: Private Sub cmdNext_Click() End Sub Private Sub cmdPrevious_Click() showrecord
3
by: KathyB | last post by:
Hi, I'm trying to find a way to validate input text boxes where I don't know the names until the page is rendered. I've got 2 validate functions that fire with the onsubmit button of a "mini" form...
4
by: TJ | last post by:
Hi, There is one aspx web page that contains usercontrol. In aspx page and usercontrol , there is each submit button... Here is what I want... I want to process something depending on each...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
4
by: Michael R | last post by:
I have what seems to me a strange problem. I have a continous form, toggle buttons of a field, a text control, and a command's button caption. When I write the following in the text control's...
23
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
1
by: fperri | last post by:
I hope that this is the right forum. I'm using VB to create a report in Excel. After the report is generated I put two buttons onto the title sheet. Both are for printing a part of the report. Here...
7
n8kindt
by: n8kindt | last post by:
i have a continuous form that i want a toggle button to display "on" or "off." everything i try changes every single caption on the continuous form--rather than the single row. here's what i have so...
3
by: Reveller | last post by:
I'm rewriting my own js library to jquery functions. A huge undertaking, but hopefully worth it in the future :) Question: why does the script always return 0 for img_width? Logo.gif exists and...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.