Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Using Return/Enter Keyboard Button Instead Of Command Button (RESOLVED)


I am entering data into 4 textboxes and then performing calcs on that data using a commandbutton.
Is there a way to use the keyboard's Enter button as a proxy for the commandbutton, if and only if the focus is on one of these 4 textboxes?

I hope that's clear.

Jim



Edited by - jimvt on 6/16/2004 4:12:28 AM




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
PPC App That Emulates The 'Enter' Keyboard Button
I'm a beginner.. I want to create an app for my PPC that emulates the 'Enter' button on the keyboard. Running the program would be the same as pressing the 'select' button (middle d-pad button). Anyone have any tips for me? I assume this will be rather simple.

Simulate A Click On A Button By Pressing Enter On Keyboard
This is probably an easy one for you:

On an html form, if you can press enter on your keyboard instead of clicking with your mouse on a submit button this will submit the form, as long as the button is of type "submit" and it is the first of any other submit buttons in the form. How can I do this in VB? How can I get an OnClick event to fire for my command button when the user presses enter on the keyboard?

Also, how do I set focus to a text field? If I do it in the form_load event it doesn´t seem to work. I want to set focus to the text field when the form is loaded.

Command Button W/the Enter Key.
hi


every time i use VBKeyReturn
it takes text from a text box and Blts it into my game.

the problem is i get that annoying windows BEEP every time i hit return.

is there anyway to stop that?

i played around withthe focus and it doesn't seem to help,

VbKeyEnter doesn't work for me, ASCii value 13 does the same thing.

Command Button W/the Enter Key.
In my program, the user has the choice of to diff't text boxes to enter data into. Both text boxes have "enter" command buttons that carry the data to it's apporiate place. I would like to see if there's a way that the enter key on the users keyboard could be used to "enter" the info based on which text box the user typed data into.

Basically, if I type into box A, the cmdEnter key for A would be active and I could just hit my enter key instead of using my mouse to click the button.

Thanks!

(hope this makes sense!)

What Was The Command For ENTER (the Button)
How to get ENTER in a txt..
If i make a MSN like pro...
how to get.. text1.text & "enter key"
it was something like "vbrct" or something like that ...

Please help!

------
I was unlucky to have a HARDWARE failure on my DATA harddrive here the other day..
And all my example code, for everything was wiped out..

So if i wonder "what is the code for doing XXX" then i must ask here instead

(5 years of example code + apps GONE FOREVER !!)
------

Command Button To Keyboard
hai guy

how to assign keybord key "enter key " to a command button
so u dont need to click it using mouse
and
how to navigate a form using keyboard key "Tab key"


tq

Disable Enter Key On Command Button
Basically in my program, there's a button that you can click and it will count up your clicks each time you press it. The problem is, once you click on this button once, the focus is set onto this button and the user can then just hold down the Enter key on the keyboard, and the click count will fly up.
Is there a way to make the Enter key on the keyboard not work on this particular command button? I just want the mouse click to be the only way to press this button.
Thanks alot.

Disable Enter On Command Button
Hi there!

Been reading the forums for a while, very good comunity and tremendous help for a lot of things ive been doing. Although i'm having problems with a small issue at the moment.

I found a post HERE that should help me, but having tried it its not really working well at all for the job.

I may be doing something wrong, but i don't think so. Using pnish's code a little way down the page it thinks i'm pressing enter even when im clicking the mouse, sometimes it will get it right but a lot of the time not. I need this to be accurate as for every click of this command button im counting.

In fact this is just for a little game ive been asked to make for demonstration. It sounded really simple. The idea is you must click the button as many times as you can in 10 seconds, but cheating is possible if you just hold down enter.

I have the whole thing working at the moment apart from the cheat prevention:


VB Code:
Private Sub cmdStart_Click()    Timer1.Interval = 1000    txttimer.Text = "10"    cmdClicker.Visible = True    cmdStart.Visible = FalseEnd Sub Private Sub Form_Load()  txtcounter.Text = 0  cmdClicker.Visible = False  cmdNext.Visible = FalseEnd SubPrivate Sub Timer1_Timer()     If txttimer.Text = 0 Then          Timer1.Enabled = False        cmdClicker.Visible = False        cmdNext.Visible = True     Else          txttimer.Text = txttimer.Text - 1     End IfEnd Sub Private Sub cmdclicker_click()  txtcounter.Text = txtcounter.Text + 1End Sub


Heres what should work using the [RESOLVED] code from pnish:


VB Code:
Dim MouseClicked As Boolean Private Sub cmdclicker_Click()     If Not MouseClicked Then    ' Assume the user pressed enter        MsgBox ("cheat")        Exit Sub    Else        '        '   Do your button-click stuff here        '        txtcounter.Text = txtcounter.Text + 1        MouseClicked = False    End If    End Sub Private Sub Cmdclicker_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    '    '   Flag that the mouse button has been pressed    '   (May want to check for left or right button etc)    '    MouseClicked = True End Sub Private Sub cmdclicker_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    '    '   Flag that the mouse button has been released    '   (May want to check for left or right button etc)    '    If MouseClicked = True Then        MouseClicked = False    End If    End Sub    Private Sub cmdStart_Click()    Timer1.Interval = 1000    txttimer.Text = "10"    cmdClicker.Visible = True    cmdStart.Visible = FalseEnd Sub Private Sub Form_Load()  txtcounter.Text = 0  cmdClicker.Visible = False  cmdNext.Visible = FalseEnd SubPrivate Sub Timer1_Timer()     If txttimer.Text = 0 Then          Timer1.Enabled = False        cmdClicker.Visible = False        cmdNext.Visible = True     Else          txttimer.Text = txttimer.Text - 1     End IfEnd Sub


Just wondered if in any way you masterminds can shed some light on the problem. I must be missing something very trivial, its so simple yet so hard.

Thanks for any help!!!!

Mathew

PS. If you want me to actually post the program, i'm very willing to do so!

Using The Enter Key To Push A Command Button ?
just wondering how i can make my form press a command button when the user hits the enter key?

Enter Button To Submit Command
I made a password field and when i type my password, i want to easily press my Enter button and it presses a command button for me on the form.

How would i make it do this? When i press my Enter/Return button, a command button gets pressed

HELP: How Do U Associate Enter Key To A Command Button
can i noe how do i Make it so that when a user Enter it will automatically press the submit command button



heard its something to do with keypress syntax

Help pls.

Enter Task And Command Button
If I have a text field and a command button, how do I declare that when the Enter task is done the command button should be activated?

Disable Enter Key On Command Button
I have to create a message box that only responds to a mouse click on the command button; if the user presses the enter key, it shouldn't answer the command button. Can anyone help?

Keyboard Binding To A Command Button
Is there a way in VB 6 to bind keyboard keys to a command button without having to do the ALT + [KEY] thing? I have written a simple calculator and was quite satisfied with it until my wife asked why she couldn't just use the NumPad keys instead of the mouse to press the calculator buttons. This is a personal project therefore not critical but any input woul be appreciated.

Clicking Command Button From Keyboard
Hi, i need to know how to do this....Consider we have 4 command buttons, each representing up,down,left and right arrow key in the keyboard..each command button will perform a specific function, how do i write a code such that...when i press the arrow keys on the keyboard, it correspondingly clicks the command button on the form, thus performing the specified function...i can click the command button using mouse, but its too tedious i prefer using keyboard....please help as it is very urgent...thank you

Using Keyboard To Activate Command Button
In my program I have several Combo boxes that need input from the user before you can proceed. Some of these have default values so after the first two have data a command button becomes active. It's at this stage that I would like too offer the use of the Enter Key to activate the command button instead of using a mouse click.

Can anyone help with some code on this.

Thanks
Tarablue

Command Button Depressed When ENTER Key Is Pressed
Hi, I have a simple form with with 3 buttons. All I want to do is when I have the focus on one button and when I press the ENTER key the focused button should be depressed till I release the ENTER key.

I want to do this using command buttons. Does anyone know how to do it?

Thanks...

Hitting Enter, Instead Of Clicking The Command Button?
Or if you want That one button only to execute nomatter which textbox you press Enter in , just set the Default property of the button to True.

Enter Key, Textbox And Default Command Button
Okay, you old hands have guessed it already from the subject line:

How can I keep the OK button as the default when the user presses the enter key on every part of the form EXCEPT the multiline text boxes, where I want it to do a carriage return and stay in the box?

Thanks, CYOCONNOR

Command Button Named Return
is it not possibel to have a command button named return?

i have got this legacy code and one of the command buttons is named return

when i try to do the following in the code


VB Code:
return.enabled = false


the program throws up the error

Compile error:
Expected: end of statement

ComboBox Validate Works With Command Button, Not Enter
I have a Validation event on a combobox that works when the OK button is clicked. The purpose is to evaluate a user entry in the combobox for correctness; it won't move on until the entry is correct. Blessedly, this works perfectly.

Problem is, if you hit enter, the Validation event is never triggered. It goes straight into the OK button's procedure. Calling the Validation event from the OK button procedure is no help. It runs through, brings up the message box, but rather than stopping to allow a new entry, it goes straight back to where it was called and continues on until it detects that the entry is incorrect.

The OK button is the default button, so you think that Enter would work identically, but it sure doesn't.

Ideas? Help?

Thank you!

Nanomous
Wholly owned subsidiary of granddaughter

Making A Command Button Be Clicked When Enter Is Pressed
I want to make my command button be able to get clicked by pressing enter instead of having to click it all the time.
Can anyone email me the code? Thanks.

Prevent The Action Of Command Button During Enter Press.
prevent the action of command button when enter key is clicked.

Doesn't Read Keyboard After Placing A Command Button?
Basically, my program is when I press left arrow, the label is 1, when released it go backs to 0.

However,when I place a command button to the form, there is no reaction to my arrow inputs.

Thx for the help

Option Explicit
Private height1 As Long
Private left1 As Long
Private num As Integer
Private blnkeyl As Boolean
Private blnkeyr As Boolean
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
If blnkeyl = True Then
num = num - 1
Label1.Caption = num
blnkeyl = False
End If
Case vbKeyRight
If blnkeyr = True Then
num = num - 2
Label1.Caption = num
blnkeyr = False

End If
Case vbKeyUp

Case vbKeyDown

End Select
End Sub

Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case vbKeyLeft

If blnkeyl = False And blnkeyr = False Then
num = num + 1
Label1.Caption = num
blnkeyl = True
End If
Case vbKeyRight

If blnkeyr = False And blnkeyl = False Then
num = num + 2
Label1.Caption = num
blnkeyr = True
End If
Case vbKeyUp

Case vbKeyDown

End Select
End Sub

Hitting Return And A Command Button Doing The Same Thing
can i call the sub for clicking a button from a keypress?

i have a text box and an ok button,i want hitting return to do the same thing as clicking ok. im using this to detect hitting return:


Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then

If (condition) Then
...do stuff
Else
...other stuff
End If

End If

End Sub
my question is can i call Private Sub Command1_Click() from inside this if statement to save having to have identical blocks of code?

How To Activate The Code Of The OK Button After Hitting The Enter Button From A Textbox?
Hi guys

I got this featues in my login screen created by the wizard.
I would really like this featuer on other forms as well.

but my login form doesnt contain the code that says how to do it.
can anyone help?
thanks.

How To Create Own Style Command Button The Command Button Properties Can Set By User?
how to create style command button the command button properties can set by user?

is it something related to .ocx file extension?

like caption can set by user
height,width can set by user
command button button can set by user...

Enabling A Command Button**RESOLVED**
Hey guys

I have a database program where text boxes, comboboxes
and an array of text boxes involved, i want to make sure
the command button stayed disabled until all textboxes are filled
i know how to enable and disable it but i am not sure where to put the code. if i put is on the last text box before saving people might skip some text boxes in the middle
anyways any suggestion is appreciated.

Animated Gif Command BUtton **RESOLVED**
How do I turn an animated gif into a command button? I can't click on the #@$&* thing.. I'm using the gif89.dll and the ax control.

*Resolved* Disappearing Command Button
Hi All,

I've got a maintenance screen with multiple text boxes and a control array of command buttons. This form is loaded from another form within the project. I'm using the validate event of a text box to keep the user there until valid input is entered, except if they want to quit out. One of the command buttons is for Quit, and I have set the causesvalidation property to false. This works fine, until I come back to this form. The command button is no longer visable, though if I click on the area it should be located, it seems to still quit. I have tried setting the visable property to true from form load, but this does not help. The click event of the quit command unloads the form, with me.unload.
Does anyone know what I'm doing wrong here?

***RESOLVED***hybrid Command Button?
is it possible to create something that is like a command button, but that the user can drag around a form?

[Resolved!] Set A Command Button Visible
MSAccess & VBA
When is a command button visible or not visible....

I'm trying to load a form, hiding or showing a couple of command buttons, depending on user access priv's.
Have tried the following lines (suggested by the help(?) topics) which access seems to just ignore.....
Code: If PubUserGroup = "3" Then
                Forms.Item(Welcome).Controls.Item(DocumentLibraryOpen).Visible = False
                Forms.Item(Welcome).Controls.Item(SupplierDataOpen).Visible = False
    Else
                Forms.Item(Welcome).Controls.Item(DocumentLibraryOpen).Visible = True
                Forms.Item(Welcome).Controls.Item(SupplierDataOpen).Visible = True
    End If
    DoCmd.OpenForm "Welcome", acNormal

Have tried putting "" round each Welcome & DocumentLibraryOpen, SupplierDataOpen elements, but no success..
Any pointers/hints/tips?
TIA

Andy.



Edited by - ErrorMessage on 11/23/2004 12:34:08 AM

Converting A Custom Command Button To A Standard VB Command Button
Hey there,
The task at hand is as follows: I have a large VB project with many forms that use a custom command button (it is the Gurhan Button, a freeware control available from PSC and other places). What I want to do is replace the Gurhan button en masse to the standard VB button.

What I have done is written a simple VB program that reads in the .frm files of the project as text, and made the appropriate replacements. This works fine except for the Picture property. In other words, a line like this:

Picture = "Form1.frx":11B4

causes problems in the converted project.
When I open the new form, I get the "There were errors, check log file for details" message. The log file message, not very useful, contains lines like this:
Line 12: Property Picture in GurhanButton1 could not be set.

Now, I am not an expert on frx files, but I would think that the reference to "Form1.frx":11B4 in the Picture property refers to its location in the file? And if so, the frx file is not being changed, so I am at a loss as to why VB cannot set the property. Any ideas?

Resolved:how To Close A Form Using A Command Button?
I have a button on my form and i have a cancel button on it. I want the form to close when i click on cancel button . could any one tell me how i can achive this task.thanks

Caption Of A Command Button Verically **RESOLVED**
Hi all,
I want to show the caption of a command button verically, how to do?

loke this

C
O
M
M
A
N
D
1

Command Button Problem (resolved-but Weird)
I've got a command button on my form, actually, the same thing is happening on two forms.

Once this button is pressed, it does what it's supposed to and works fine. But, if a form is opened and displayed over this button, then that form is closed, the command button graphics show the graphics from the form that opened over it. I've tried refreshing the form and the button and neither worked. The button still works like it should, just has the graphics from the other form "burned" on top of it. It's set to graphical style and has a colored background. The button is also situated on a label on the form, same type of button that's not on a label doesn't have this problem.

The "burn" affect doesn't happen untill after the button has been clicked at least once. Then if a form opens on top of it, that forms graphics burn onto the button.

Any ideas?

This is what it looks like - the bottom right corner with the piece of the information bubble thing is supposed to be a light blue button that says new search. This is what it looks like after a message box displays on top of it.

Problems With Command Button Pictures (RESOLVED)
Hi,

Should be really easy for someone to solve, i've read through the Microsoft documentation but I can't find any restrictions related to what im attempting.

Basically I want a small .bmp file to appear in my command buttons, I have two buttons one for printing and one for viewing. I want to see what it looks like to have a magnifying glass and a printer on the buttons. Atm I have picture boxes which do the neccessary processing when clicked, but I would like the visual feedback offered by buttons.

I have selected the image using the picture property but it never appears.

Any ideas?

Thanks



Edited by - GraemeW on 2/24/2005 8:04:02 AM

---Resolved----How To Change Text Color Of Command Button ?
I don't know how to change text color of command button ? Please help. Thanks

Click A Command Button When &"enter&" Is Pressed In A Text Box?
Hi,
I was wondering how I can call the click function of a command button when the enter key is pressed in a textbox?

Thank you :]

Keypress Event For Command Button Is Not Working For &"Enter&" Key Why?
The code which i write below is not working i didn't get why?

keypress event for command button is not working for "Enter" key why?

please reply

Private Sub Command1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
MsgBox "HI"
End If
End Sub

Pressing &"Enter&" To Activate A Command Button
How do you program a command button to be activated when the enter button is pressed rather than having to use a mouse to click on the button? eg. If there is a text box for a user to enter their name, how do you make it so the "Submit your info" command button will be activated when pressing enter?

Ty.

Activating The &"Click&" Method Of A Command Button Using The Keyboard
I've got a command button with a Click() method, I want this method to be executed when I press the "Enter" key on the keyboard.

Does anyone know how to do this? Thanks in advance.

Command Button Event Occurs Only When The Button Is Double Clicked !
Hai,

I am using a MonthView Control and Two Command Buttons (Ok & Cancel) inside a Frame, Its designed as the MonthView Control will display 2 Columns and 1 Row. Now what happens is when i change a date in the MonthView Control, then i need to double click the Command Button, then only the Command Event occurs (Either its Ok or Cancel Button). If i didn't change the Date in the Monthview Control, then i am able to do the CommandButton Event work with the single MouseClick. I think if i change Date in the Calendar (i.e MonthView Control), then there is some thing affected in the Focus of the Command Button, after I change the date and press the command button, the button seems to be selected (marked) but the event didn't occured. I tried with the BreakPoint also. Can any one help me regarding this.

Thankyou,
Chock.

Command Button Event Occurs Only When The Button Is Double Clicked !
Hai,

      I am using a MonthView Control and Two Command Buttons (Ok & Cancel) inside a Frame, Its designed as the MonthView Control will display 2 Columns and 1 Row. Now what happens is when i change a date in the MonthView Control, then i need to double click the Command Button, then only the Command Event occurs (Either its Ok or Cancel Button). If i didn't change the Date in the Monthview Control, then i am able to do the CommandButton Event work with the single MouseClick. I think if i change Date in the Calendar (i.e MonthView Control), then there is some thing affected in the Focus of the Command Button, after I change the date and press the command button, the button seems to be selected (marked) but the event didn't occured. I tried with the BreakPoint also. Can any one help me regarding this.

Thankyou,
Chock.

How Do I Add A Wav File To A Command Button, Also Change The Color Of The Button When
I am having trouble with this. I am able to make a windows default soung by inserting the word beep, however if i want a different sound how to i define it. also i have forgotten exactly how to write the coding for changing the button color when it is selected. Any help would be greatly appreciated.

? Change The Font & Button Color Of A Command Button
Hi,

I would like to change the font & button color of my command buttons, Does anyone know how I can do this?

Also I am curious as how to change the color of input boxes & menu bars?

Any help is greatly appreciated! Thanks in advance!

Donna

Make A Image Visible By Clicking In A Command Button On A Different Form?- Resolved
Hi,

i wonder if anybody can help me.

My Problem is as follows:
I have two forms. On the 1st form is a hidden image and on the second form is a command button.

I want the image to become visible on the 1st form when i click the command button on the 2nd Form.

Is this possible?

i know the code is simple if the image and command button where on the same form. i would put the code Image1.Visible = True in the Command button Click event. but when i do this with the image and command on seperate forms the program throws up an error! Do i have to connect the two things through a module? if so what would the code be?

Thank for your help!

Magical And Annoying Command Button Problem (Resolved And A Jelly Tree)
I have this problem with buttons if i enter a form and change the button from orange to green and then exit (Unload as well). When i re-enter the form (reload) the button that i changed has more or less vanished.

The Area where the button should be picks up any cr** that appears on screen , e.g if i minimise and then maximise the form the details from behind the form appear where the button should be!!!

See attached

Enabling Command Button By Clicking Another Command Button.
Hi again, i was just helped on this site majorly thankyou ! I have one more question:

See the image below. I want to make for example; when you click "dan" and "kwan" it enables you to click the things valued at "dan" and "kwan" i.e. "dario hat" for example. Also, how to make it so "dario hat" is valued at "dankwan". If your curious, we had to make our own currency lol.

Copyright © 2005-08 www.BigResource.com, All rights reserved