Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to search for a string / word in a memo field
Message
From
08/06/2006 22:02:03
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
08/06/2006 21:47:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01128004
Message ID:
01128023
Views:
25
This message has been marked as the solution to the initial question of the thread.
>Do you have sample code on how to use these properties?
>
>Thanks
>
>Bob

I forgot to mention an important function, at() (indicate at what position the substring is located).

I improvised the following sample.

Create a form, place an EditBox called EdbSample on it.

Add a button to the form; in the Click() Event, place the following code:
local lcWord, lnPosition
lcWord = "some"
with ThisForm.EdbSample
	.Value = "This is some text" + chr(13) + chr(10) + "Line 2"
	lnPosition = at(lcWord, .Value)
	if lnPosition > 0 && if found
		.SelStart = lnPosition - 1
		.SelLength = len(lcWord)
	endif
	.SetFocus()
endwith
A real textbox will - in many cases - be bound (through its .ControlSource) to a memo field, but the code should probably still work.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform