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




Return (Enter) Key In Code


Can you add <Enter> keys to a textbox in code? I've tried using Chr(13) but I'm getting a short black vertical line where there should be a new line started.

Here is the code I'm trying to get to work:

*********************************************
txtShipToAdd.Text = cboSoldToFirm.Text & Chr(13) _
& cboSoldToName.Text & Chr(13) _
& cboSoldToAddress.Text & Chr(13) _
& cboSoldToCity.Text & ", " & cboSoldToProv.Text & Chr(13) _
& cboSoldToPostal.Text & Chr(13) _
& "Tel: " & cboSoldToTel.Text & Chr(13) _
& "Fax: " & cboSoldToFax.Text & Chr(13) _
& "Email: " & cboSoldToEmail.Text
*********************************************

Any Ideas?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Carriage Return(enter Key)
hi you all

can anybody help!!

I'm trying to check for the enter key been pressed and for some reason it does not work. if I change the 13 to 32(space bar) it works fine what i'm i doing wrong.

All i want to do is change the updown1(control) to the value of the Text1.Tex(control).


Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
response = MsgBox("dsdf", vbOKOnly, "dfg") 'just to see if it works
UpDown1.Value = Val(Text1.Text)
KeyAscii = 0
End If
End Sub
thanks the pig

Enter And Return Keys
Puzzling question seeks answer.

I am creating a calculator program....
The questions:
1. I have figured out using the form_KeyPess Sub Function to determine the numkey pad by using ascii. I can read the ascii characters from this function with keypad numbers and operators, even the equals key. I get no ascii character when I press the enter or return key. The only thing that happen is that the select button on the calculator is activated when I press the the enter or return key.

What would the function that reads the enter and return keys look like that won't affect the buttons. Or how do I prevent the buttons from being activated by the enter/return key ?

Please, Please help

Newbie, Adding A Return To Code So Shows Up As A Return In A Text Box
i want to add code to lets say a command button so that when i click it certain text appears in my text box. ok i got that. but now i want to add code so that when i want i can just add to the

txtMessage.text = XXX.text & "RETURN KEY HERE!!!" & XXX.text

and in the RETURN KEY HERE!!! having it display the text inserted in code with the return key when command button is clicked.

yes i know stupid question but i want to know

How Can I Tell The Diff Betrween Enter And Carriage Return
I'm trying to trap these key strokes - VB Books online tells me that vbKeyReturn has a value of 13 and vbKeySepartor 108. But all I can get is 13. any Ideas

Moving To The Next Line In A Textbox (WITHOUT) Pressing Enter (return)???
Hi,

I would like to press a button that will make txtInput go to the next line, How would I do this???

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

How Do I Code An Enter Button?
I am teaching myself Vb6, and I have searched high, and low on how to code a enter button to go from one form to another.

When I press the Enter button, I want to proceed to a master form.
What I am trying to do is have password form popup, the user enters
in his/her user name and password, and then those are checked against
values in a database. If the user name, and password are correct, then
the user can enter the master form where they can add, update, delete data.

This seems simple but I have not been able to figure it out.
One more item. In the password text box, how do I get it to display
********* when the user enters in his/her password?

Sorry for being so verbose.

Thanks,

Sketchit

What Is The Next Line Code Like Enter?
Hi, everyone , i have a question. What code should i type in order to give this kind of display below, when i send a message to phone.

I want this kind of display:
welcome
1) select
2) cancel

But not this kind of display:
welcome 1) select 2) cancel


Thanks for help.

[RESOLVEDS] What Is The Key Code For ENTER ?
The question is clear I think

Using The [Enter] Character In Code
I want to replace all of the then [Enter] Characters in a text file with code, but i'm not sure how to input it

Whats The Code For Enter?
argh this is hard to find

i keep forgetin


how do we do enter in vb?

tab = vbTab
enter = vb???????????????????????????


please help me


tnx alot

Run The Code When I Press Enter?
After that I select a value in the listbox and press Enter, a specified code should start. How can I run the code when I press the Enter button?

I Want Make Enter In Code
I want Make Enter In the Text And Save It in database
for example
: there is (Space(5) ) in Vb ,Is there Somthing Make enter in vb?
i don't want it in multline text field
no......... i write constant text in variable that have enter
like:
"my name is mahbob
i have 23 yera
as ssson"


plz help me

How To Code To Use ENTER Key For Navigation Instead Od Tab
Normally TAB key is used to navigate between different controls in a form.If required can we use onloy ENTER key for that.That is ,after data entry an ENTER key should take to other item.
Any property to be used or if coding requierd how it is?

Keyascii Code For Enter-button
who can tell me whats the keyascii for the enter-button ?

i need it in my inputform
i want to move to focus to the next textbox after an input and a press on the enter-button

who can help me

Problem With Re Enter Password Code
I have a form where i im adding a new user, and i have set it all up and written the code

Code:
Dim rs As adodb.Recordset
Dim rs2 As adodb.Recordset
Dim conn As adodb.Connection
Dim sql As String
Dim strForename As String
Dim strsurname As String
Dim strtitle As String
Dim strArea As String
Dim strStaffid As String


Private Sub cmdAdd_Click()
'Set connection
Set conn = New adodb.Connection
conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "system.mdb"
conn.Open
Set rs = New adodb.Recordset
Set rs1 = New adodb.Recordset
'get records into staff record set
sql = "SELECT * from tblStaff"
rs.Open sql, conn, adOpenKeyset, adLockOptimistic

'get records into user recordset
sql1 = "SELECT * from tbluser "
rs1.Open sql1, conn, adOpenKeyset, adLockOptimistic
'add new record to recordset
rs.AddNew
rs1.AddNew
'assigining values to fields

rs!Staff_id = txtstaffid.Text
rs!Forename = txtForename.Text
rs!surname = txtSurname.Text
rs!Title = txtTitle.Text
rs!Area_of_teaching = txtArea.Text

rs1!UserName = txtstaffid.Text


If txtpassword.Text = txtreenterpassword.Text Then
rs1!Password = txtpassword
'reset field values
rs!Staff_id = txtstaffid.Text

txtstaffid.Text = " "
txtForename.Text = " "
txtSurname.Text = " "
txtTitle.Text = " "
txtArea.Text = " "
txtpassword.Text = " "
txtreenterpassword = " "


'after making changes update recordset
rs.Update
rs1.udate
Set rs = Nothing
Set rs1 = Nothing
'close record set
rs.Close
rs1.Close
Else
MsgBox "Entered passwords did not match. Please try again"

End If
-----------------------------------------------------------------------
The problem is that it writes to my staff table, but, the user table which holds the username and password does not get updates.

Anyone know why?

Thanks

Can't Find Code For Allowing Use Of Enter Key
This is a very simple but elusive problem for me. I have a project that uses the mouse to proceed on all forms. But I would like to give the user the option of using the Enter Key. So far, in searching the web, I have not been able to find the code that checks for the Enter Key being pressed. I would greatly appreciate anyone supplying the code

Code To Enter My Message Not Working
Hi
Thanks for all the advice i thought this would do the trick but even if i dont type in a duplicate number I get the message
You have entered a duplicate npan number. Please check your records",

can anyone help im so close " I think"



__________________________________________________ ______________
Private Sub npan_elec_AfterUpdate()
On Error GoTo Err_npan_elec

DoCmd.RunCommand acCmdSaveRecord

Err_npan_elec:
If Err.Number = "3022" Then
MsgBox "You have entered a duplicate npan number. Please check your
records", vbOKOnly
Me.inv_no_elec.SetFocus
Me.npan_elec = Null
Me.npan_elec.SetFocus
Else: MsgBox "An unforseen error has occured please contact your
admisistrator", vbOKOnly
Me.inv_no_elec.SetFocus
Me.npan_elec = Null
Me.npan_elec.SetFocus
End If

End Sub

VB-Excel: Code To Determine If Delet, Tab Or Enter
In Visual Basic, I learned about KeyPress which allowed the programmer to determine what keys where hit.

I need to use this concept in Excel. However, KeyPress is not an option.

My goal is to determine at the beginning of the code whether the user hit the <Enter>, <Tab> or <Delete> key.

Based on this entry, the code will take different paths.

Jim

Mouse Click And Enter Key For Button Code
Good Afternoon

Shopping for some help on my V/B 6 program. Currently all functionality is working as designed with mouse clicks on the buttons. Is there a way to
let the user hit the Enter key to fire off the button code? Basically, they want to be able to click the mouse or hit enter to make a button work.

Anyone have ideas?

Thanks for the help,
EJD

Code? To Enter Date Into TextBox With CommandButton
I'm a newbie modifying some old code, and it's been going well so far.
One thing I would like to add, is what my subject says.

When a user clicks a CommandButton, I would like the current date, in the format dd/mm/yy, to be entered into a TextBox where the user has placed the cursor. There are three potential date text boxes (which is the reason it needs to go where the cursor is).

Any other ideas would be considered, but I would mostly like to figure out the code for this method.

Something with DateTime or DateFormat?
Thanks!!!

Open A Table With Code To Enter Data
Hi Folks
I am fairly new to VB. My problem is this.
I have created a form in Vb, i want to open a table in an access database. i need open the table in edit mode so i can enter data imeadiatly.

The next problem is how do you add a new record, using code?

Thanks in advance.

Enter To Move To Next Tab (simplify Repetative Code)
I have 21 text boxes for input (Text00 to Text20). I have an ADD and EDIT routine. I have the tabs set correctly.

#1 Is there a way to write this so I don't have to have one of these for each text box?

#2 I notice when I ADD, and hit enter from Text00 I move to Text01 ... BUT ... when I EDIT and hit enter from Text00 I move to Text02.

Thanks!!!


VB Code:
Private Sub Text00_KeyPress(KeyAscii As Integer)    KeyAscii = Asc(UCase$(Chr$(KeyAscii)))    If KeyAscii = 13 Then    SendKeys "{tab}"    End IfEnd Sub

Code On 'Return' Key
Hello,

I am wondering how can I place code to be executed when I press the 'Return' key.
i.e. When i'm performing a search on the database , I want it to commence when I press 'Return' and not actually have to press a button to run the code.

Any ideas please send them on.

Thanks
Dave

Return Code...
This may be simple, but is it possible for a program to return a number in VB? Like in C++, at the end of the program you would say "return 0;" or "return 1;" to specify the success of the program. Is VB able to do this?

Help! How Can I Specify An VB6 EXE Return Code ?
NEED A RETURN CODE


I need to specify a VB6 EXE application a return code different from 0 (the default one), but I cannot do so.

After a day of search in MSDN and online, I could not find any way of doing return(1); as in C++.

Anybody know how to do it in VB? Or any trick using Windows API that will lead to a return code different from 0.

Many thanks in advance.

Jerome

Return Code
Hello all,

I am currently using WNetAddConnection2A() to map network drive.
It fails and returns 1200.
Can anyone tell me what does 1200 mean ?

Thanks a lot

Nelson

Return Code 506
I was zipping a file within VB and got a return code of 506. Does any one know what could have caused this.

Dialog Box For Users To Enter Column No's For Code To Actions On
I would like to know how to create a dialog box which lets a user enter one or more Excel column numbers (e.g. A or A,B,C or C,F,H,J etc). The columns entered then need to be used in VBA code which returns a conditional color format to each cell in the used range of each of the selected columns.

The conditioonal color format is based on the result of a formula calculation for each of the used range cells in each column which is carried out on a different worksheet.

Thus, I need to use the column information selected by the user in the code to determine where to return the color format


Hope this is clear .... let me know if you want more info.


Thanks a lot

Gerry

Code To Drop To Next Textbox With Enter After Entry Is Made
Gentlemen:

I have a form with 6 variable textboxes and wish to know how to provide the coding that will move the User to the next Textbox once an entry is made in a given textbox.
How do I make the "Enter" key trigger the move, instead of the tab key?

How To Code For User To Press Enter To Execute Command
Hello All -

I have a text box into which the user enters text commands. The way it's set up now, as soon as the requisite text appears in the text box the appropriate command is invoked. It's a very simple series of If...Then statements:

Private Sub txtCmdLine_Change()
    
    If LCase(txtCmdLine.Text) = "new" Then
        txtCmdLine.Text = ""
        mnuFileNew_Click
    End If

    If LCase(txtCmdLine.Text) = "save" Then
        txtCmdLine.Text = ""
        mnuFileSaveAs_Click
    End If

    If LCase(txtCmdLine.Text) = "open" Then
        txtCmdLine.Text = ""
        mnuFileOpen_Click
    End If

            Etcetera


How can I "interrupt" the process so that the user must press the ENTER key after typing in the text command?

Thanks very much,

SZW

How To Enter Morethan 11 Digits In Excel Cell From Vb Code
hello


i am trying to enter morethan 11 digits(number) in excel cell from vb programme, but it is showing in scientic format. Pl. help me how to enter morethan 11 digits in excel cell from vb programme.

send to my mail id : gajulauma@yahoo.com

thanx
umasankar

Can VB Return A Erro Code ?
I use VB6 and I want to have a error code at the end of my software.
Like the Return in C.

Is it possible ?
I know that Command contain input command...but I didn't find how to output something..

Thanks

Set Return Code On 'exe' Exit
Does anyone know how to return a value to the command line when exiting a compiled exe?
I have tried to raise an error before exiting but I suspect that it is reset to 0 when exiting the Sub Main() procedure.
I have checked everywhere but can't find anything about it - surely it would be safe to assume that this would be a fundamental requirement of any programming language.

SQL Agent VB Return Code
Hi all. (long time no see)

SQL Server 7.0/VB 6.0

I'm running a VB exe from SQL Server Agent on a scheduled basis. Sometimes the job fails and hangs. SQL Server Agent has a place to specify actions based on a return code. How do I populate that return code from the VB exe?

As always, Thanks in advance.

SQL Return Code Checking
newbie poster.
It's got to be really simple, but can't find in Help or ref books
How do I check sql code after Execution of sql string? E.g.
connection.execute 'sql update query' may or may not find a record to update. I want to take different action on each. Any ideas? Thanks in advance.

Return Code To DOS From Vb6 Console
I have written console application in vb6 to perform some tasks.It refers some external com DLL/ActiveX Exe's for some operations.Now i need to return the exit code to dos.

I have tried API ExitProcess to return code but application crases because memory cleanup which is done by VB 6 runtime is not performed.

All refrences are cleared before calling Exit process.

I have also tried using CoUninitialize just before ExitProcess but it does'nt solve the issue.


Is it possible to return the code to dos ?

Run EXE Program From VB And Get Return Code
I have looked extensively here and elsewhere and can't seem to find the answer... apologies in advance if I've overlooked it.

I need to run an exe program from within my VB program, wait until it finishes and then get the return code from that exe program. Any and all help appreciated....

VB6 Executable Return Code
Hey there,

This is going to be pretty straight forward...

I'd like my VB app (which initiates using a Sub Main() procedure) to return an integer value upon the end of its execution. How do I do that?

My VB app will be called from the xp_CmdShell extended stored proc of SQL Server 2000 which handles exe return codes. I'd like to make good use of this interesting feature.

Anyone?

Thanx,
HiKs

VB6 Executable Return Code
Is it possible to let a VB executable give a return code. So, if my program runs correctly, the executable returns 0 and if there is an error it returns 1, for example.

I need this because my VB program is a batch program that is started from an AVAS (Siemens) scheduler. The scheduler needs to know if the program has run correctly (which it can tell by checking the return code of the program) before it can continue executing the other programs in the batch process.

Thanks in advance for your help.

Return Code From Exe File
Is there another way besides using the API function ExitProcess
to return a value from an exe file

Return Code From VB Program
Hi,
I am working on a VB program (.exe) that will be called from a flow control utility under Windows NT. The flow control utility expects a return code from my program to take an appropriate action. Does anybody know how to return a value from Sub Main?
Or in general: how to return value to the system that can be picked up by the calling program?

I am tired of unsuccessfull browsing thru manuals, buletins, MSDN, e.t.c.

Help ASAP if you can as it is quiet urgent....

Regards -jk-

Return Code From VB Program
Hi,
I am working on a VB program (.exe) that will be called from a flow control utility under Windows NT. The flow control utility expects a return code from my program to take an appropriate action. Does anybody know how to return a value from Sub Main?
Or in general: how to return value to the system that can be picked up by the calling program?

I am tired of unsuccessfull browsing thru manuals, buletins, MSDN, e.t.c.

Help ASAP if you can as it is quiet urgent....

Regards -jk-

Return Identity Col Value Thru Code
I am using VB6 ADO to add a record to a MSSQL 2000 table that has an Identity field. Once the record is added I need to know the value of that Identity to add a record to another table. This is a multi-user db and I have found instances where the time stamp is the same on two records.
I have read the threads on @@IDENTITY but they all involve using a stored procedure to add the new record. I prefer not to do that.
Is there no way to get the IDENTITY value of a newly added record except through @@IDENTITY or am I missing something.

Accessing A RETURN Code From SP
CODEDim Status_Parm As Parameter

cmd.CommandText = "spAddQuantity"
cmd.CommandType = adCmdStoredProc
    
Set Status_Parm = cmd.CreateParameter("", adInteger, adParamReturnValue)
cmd.Parameters.Append Status_Parm

cmd.Execute

Code To Return Pagenumber
Which code returns the pagenumbers of -even- pages?

I want to do some action on all even pages.

VB Program Run Return Code
I am starting a VB program on a Win 2000 machine from the main frame Z/Os using Tivoli Scheduler. I want to track the
success or failure of this VB program which should be reported
to the Tivoli Scheduler. Is it possible to set a return code in VB
for example 0 for program ended successfully and 1 for failure?

Thanks
Jay

Return Code For Exe Created In VB
I have aproject which is a simple exe project. I have another program in C## launching this VB exe. I want to communicate to the C## program that when my exe encountered any internal error or not while executing.

How do I do that. One way is to write to file and C## program can read the file for the error.

But is there a generic way of exiting the VB exe and returning a status code of -1 or something.

What happens if my VB application comes across a run-time error and exists. What is the return code given back to the calling program.

This is Very Very urgent. Any help will be greatly appericated.

Thanks!

Return Code From VB Application
Hi,

Is it possible to return code from vb application ?

thanx,
pokpoki.

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