View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike NG Mike NG is offline
external usenet poster
 
Posts: 87
Default Direct manipulation of TextBox

This is a simplified version of my code. Basically, I have a function
which takes a source string, does some manipulation, passes back a
target (result) string, and sets the function return to true or false
bases on certain conditions

Function a_test(sSource As String, sTarget As String) As Boolean

sTarget = Left(sSource, 1)
a_test = True

End Function



The workings of the function are not important. What I am doing is
calling this on the exit of one textbox to populate another textbox on a
UserForm


Now doing this will not work

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim x As Boolean
x = a_test(TextBox1, TextBox2)
End Sub


I have to use an intermediate variable instead

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim x As Boolean
Dim y as String
x = a_test(TextBox1, y)
TextBox2 = y
End Sub


I tried the first method with .Value and .Text and these didn't work.
Surely if textboxes are read/write I can manipulate them directly...or
can I?
--
Mike