FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Visual Baisic Help Please

 


The-Master
OK. I have been programming with visual basic for about a month and made several useful programmes so I am not a complete newbie!

What I need to know for my next programme is how to get it so that you have a textbox and you start typing in it, it says "hello" or whatever I want it to say no matter what the user types.

Sorry its a bit difficult to explain. But say the user types "1"(could be any key they choose) in the textbox I want it to come up as "H" then the second letter they choose it would come up as "e".

This is very complicated to explain so I hope that came out OK and I know there are some really good programmers on this forum who could help me out. Thanks Very Happy
pozzler
Hello,

I do not have VB installed right now, but there is a simple solution for that.

You have to create "KeyDown" event for your textbox control, check the keycode (to verify that user pressed one of the alphanumerical keys) and append another letter to textbox.
After that, set cancel flag of the event to true.

Hope that helps

Wojtek
Teddy1
here is one way.

Under Text1_Change()

Code:

If Len(Text1.text) < 1 Then
Text1.Text = ""
End If

If Len(Text1.text) = 1 Then
Text1.Text = "h"
End If

If Len(Text1.text) = 2 Then
Text1.Text = "he"
End If

If Len(Text1.text) = 3 Then
Text1.Text = "hel"
End If

If Len(Text1.text) = 4 Then
Text1.Text = "hell"
End If

If Len(Text1.text) = 5 Then
Text1.Text = "hello"
End If

If Len(Text1.text) > 5 Then
Text1.Text = "hello"
End If


This makes it so that if the length of characters typed in text1 are lower than 1 then the text shown is blank, and replaces the characters as you type. if the length of characters typed equal more than 5 then the text shown is hello.

I hope i have helped Smile
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.