473,382 Members | 1,165 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,382 software developers and data experts.

How to create a shortcut key to evoke a built event

beacon
579 512MB
Hi, this is probably fairly easy, but I don't have a ton of experience with Visual Basic and I haven't been able to find the answer I'm looking for online or in any of my books.

First, let me ask this. Is there a way, sans code, to cause a radio button with a true value to become false again? I guess what I'm asking is whether or not you can press F5 or double-click the radio button to make it return to a false value.

If the answer is no to the previous question, how can I set up my radio button(s) to where they will be returned to false if I press some key on the keyboard?

I tried the double-click event and wrote code to set the button back to false, but that didn't work out so well. You have to double-click and hold, then drag your mouse away from the button to get it to work.

Oh, I'm not sure if this is taboo or against the rules, but I'm using the Visual Basic Editor in MS Word 2003. And this is a work project, not a homework assignment I assure you.

Any ideas?? Anyone...anyone...Bueller...Bueller.
Nov 27 '07 #1
5 1732
Dököll
2,364 Expert 2GB
Hi, this is probably fairly easy, but I don't have a ton of experience with Visual Basic and I haven't been able to find the answer I'm looking for online or in any of my books.

Any ideas?? Anyone...anyone...Bueller...Bueller.
You've seen "Ferris Bueller's Day off", I suppose;-)

Can you tell us little more? Above is great but programatically what is happening?

for the Radio button to become false again, or to not have focus (which is what can happen in code) is there another event that goes through.
.

Please stay tuned if you ahven;t heard anything from me. Other experts will likely see this and can come to your aid also. You can also do a MouseMove event to get it to revert to false also.

How many radio buttons are there?

In a bit!
Nov 30 '07 #2
QVeen72
1,445 Expert 1GB
Hi,

Write this code for all the Option-button's KeyUp event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Option1_KeyUp(KeyCode As Integer, Shift As Integer)
  2.     If KeyCode = vbKeyEscape Then
  3.         Option1.Value = False
  4.     End If
  5. End Sub
  6.  
So, when User has Selected, an Option and he presses Escape, the Option is not Selected.
Alternatively, you can write in Form's Key-Up event also , make value =False for all the option buttons (with Form's KeyPreView=True)


Regards
Veena
Nov 30 '07 #3
beacon
579 512MB
Write this code for all the Option-button's KeyUp event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Option1_KeyUp(KeyCode As Integer, Shift As Integer)
  2.     If KeyCode = vbKeyEscape Then
  3.         Option1.Value = False
  4.     End If
  5. End Sub
  6.  
This is what I typed in using your code idea:
Expand|Select|Wrap|Line Numbers
  1. Private Sub OptionButton11_KeyUp(KeyCode As Integer, Shift As Integer)
  2.     If KeyCode = vbKeyEscape Then
  3.         OptionButton11.Value = False
  4.     End If
  5. End Sub
  6.  
And this is the error message I received when I compiled it:
Compile Error:
Procedure declaration does not match description of event or procedure having the same name.
Previously, when I attempted to code this myself using the double click event, this is the code I used:
Expand|Select|Wrap|Line Numbers
  1. Private Sub OptionButton11_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
  2.     If OptionButton11.Value = True Then
  3.         OptionButton11.Value = False
  4. End Sub
  5.  
When I use the above code, you have to double click on the radio button with the mouse, hold down the mouse button on the second click, and then drag your mouse to a white area before releasing in order to get it to clear. Basically, it's a pain in my Bueller (just to keep the reference going). I was hoping to set up code that will enable me to set up a button that will essentially do the same thing, but without having to click on it.

We use another program at my work that allows you to do this by pressing F5 and I was really hoping to be able to setup the F5 key to evoke the same event when pressed using this form. Please keep in mind that this is a Word Document using Word's VBA editor and that it will be used across a shared network.

I have a bunch of radio buttons, but there are a lot of different groups and I would really rather give each of them the same code than create an event that clears them all (don't know if that's possible, but I thought I'd throw that out there because it won't benefit me).

Thanks for all you do...each and every one of you...whoever you may be.
Dec 1 '07 #4
QVeen72
1,445 Expert 1GB
Hi,

Sorry, My Code was for VB6..

Regards
Veena
Dec 2 '07 #5
beacon
579 512MB
Hi,

Sorry, My Code was for VB6..

Regards
Veena
Do you know if there's a work around maybe to get it to mesh with the VBA editor in Word?

Is there a good reference site I can go to to find more info?
Dec 3 '07 #6

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

Similar topics

5
by: Eskimo Joe | last post by:
I am trying to create a desktop icon using VB6. is this possible? -p
1
by: Tom | last post by:
I created an msi using the Setup Wizard, but don't seem to be able to create a shortcut to the applicaton on the desktop (or prompt for one) or the menu. Also, I would like to add an "uninstall"...
0
by: cefrancke | last post by:
I recently discovered, that if you set the startup options for "security", you will have alot of work do to get Access back to "normal". If you disable the built-in menus/toolbars you'll have to...
4
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
18
by: Adda | last post by:
I have an mdi form and I am trying to call a procedure - "myTest" in the parent from the childform. I am experimenting using a thread, but the thread is not releasing the childform. I place a...
2
by: MJB | last post by:
I'm using Visual Studio 2005 and I have built an msi using the built in setup project. My application installs fine, but on install the application itself runs a few configuration scripts which...
5
by: Linds | last post by:
I have a report within my access database that I would like to have a shortcut on my desktop that could bring up that report. In other words, now I have to double click on the database, then go...
9
by: tigger | last post by:
Hi, I'm using Visual Basic 2005. I'm trying to create shortcut keys for my buttons. Currently, i have 2 buttons, presentButton and plotButton. When i press spacebar, it will perform the...
3
by: sanghavi | last post by:
how to create a set up project in vb.net..how to run an application on a different machine
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.