|
-
Nov 15th, 2005, 06:28 AM
#1
Thread Starter
Fanatic Member
is this code is possible?
hi, it is possible to made like with this code?
lets say...
i have a Text1.Text and set as multiline = you will right your own message
then... if the Text1.Text received "HI" i want the msg Box appear Found "HI" then go typing... if Text1.Text received again" hello i want the msg box appear Found "HELLO"
is this possible?
i tried like this but get no luck
VB Code:
Do
if InStr(Text1.Text, "HI") Then
MsgBox("Found: HI")
Else
End if
if InStr(Text1.Text, "Hello") Then
MsgBox("Found: Hello")
Else
End if
Loop
thanks..
-
Nov 15th, 2005, 06:34 AM
#2
Re: is this code is possible?
Are there specific words you want to find in the text?
I code C#....

-
Nov 15th, 2005, 06:41 AM
#3
Thread Starter
Fanatic Member
Re: is this code is possible?
yes... example... Hi, Hello, You,
thanks.
-
Nov 15th, 2005, 06:46 AM
#4
Re: is this code is possible?
Try
VB Code:
Private Sub Command1_Click()
Dim strSearchFor As String
Dim intFound As Integer
strSearchFor = "Hi"
intFound = InStr(Text1.Text, strSearchFor) ' look for word.
If intFound Then ' If found,
Text1.SelStart = intFound - 1 ' set selection start and
Text1.SelLength = Len(strSearchFor) ' set selection length.
MsgBox "Word found"
Else
MsgBox "Word not found."
End If
End Sub
-
Nov 15th, 2005, 06:49 AM
#5
Thread Starter
Fanatic Member
Re: is this code is possible?
@Hack
your code works... but i dont want to press a command button...
let say if i type on Text1.Text Hi it will appear automatically the msgbox..
thanks..
-
Nov 15th, 2005, 07:04 AM
#6
Re: is this code is possible?
just place the code in to the desired event of the textbox like on_change, validate, lostfocus, exit
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Nov 15th, 2005, 07:05 AM
#7
Re: is this code is possible?
 Originally Posted by nokmaster
@Hack
your code works... but i dont want to press a command button...
let say if i type on Text1.Text Hi it will appear automatically the msgbox..
thanks..
All code that I post is posted as an example. Generally speaking, I have very little idea of how the member asking the questions wishes to use the code (and often, I have no idea at all).
If you don't want to use the code in a click event, then move to the Change. I would submit that the keypress event should not be considered unless you want to the code to fire every single time you press a key, which could get very, very annoying to whoever is doing the typing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|