PDA

Click to See Complete Forum and Search --> : Change the title


dandono
Aug 17th, 2004, 05:16 AM
if any one wanted to know how to have a user make the title insted of programing a title into a vb application here's how to:

you need a text box and a button and this is the very simple code

Private Sub Command1_Click()
Form1.Caption = Text1
End Sub

one line of code and it is done.. but does anyone know how i can do this by pressing enter on the keyboard

i know how to change it as soon as a letter is typed in to the text box like this

Private Sub Text1_Change()
Form1.Caption = Text1
End Sub

but there must be a way of getting something to happen when i press enter on the keyboard.. please post a reply

rm_03
Aug 17th, 2004, 11:44 AM
Hi,

you could try it this way:

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Me.Caption = Text1
End Sub

But then it will make a cruel "pling"...

dandono
Aug 17th, 2004, 04:16 PM
thanks it works now
later

Danial
Aug 19th, 2004, 09:39 PM
Originally posted by rm_03

But then it will make a cruel "pling"...

To stop the "pling" or beep you could use :


Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
End If
End Sub

dandono
Aug 19th, 2004, 09:51 PM
cool thnx