>This is my code in the push button's click event -
>
>LOCAL cChar
>cChar = ""
>nSelStart = THISFORM.txtAddress.SelStart
>DO FORM eForeign TO cChar
>
>WITH THISFORM.txtAddress
> IF !EMPTY(cChar)
> .Value = STUFF(.Value,.SelStart + 1,0,cChar)
> .Refresh()
> ENDIF
> .SetFocus()
>ENDWITH
>
Rex,
SelStart goes to zero as soon as focus leaves you textbox. Focus leaves your textbox whne the button is clicked. So wehn your code is running the textbox has a selstart of 0 and it should.
To do what you want you can use a form property. In the fomr desinger add a property named nSelStart and one named oTxtBox. Then in the LostFocus of each textbox put this code;
THISFORM.nSelStart = THIS.SelStart
THISFORM.oTxtBox = THIS
Then in your button you can use;
THISFORM.oTxtBox.Value = ;
STUFF(THISFORM.oTxtBox.Value,THISFORM.nSelStart + 1,0,cChar)
Be sure to put this line of code in the Destroy of the form though;
THISFORM.oTxtBox = NULL