Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function Call problem 1

Status
Not open for further replies.

Sika2

Technical User
Sep 25, 2001
41
NZ
Hi All

In the following code I am getting an error of "Function call on Left hand side of assignment must return variant or object"

It has a number entered in the text box. Any remedies appreciated.

If Val(Txt1.Text) = 0 Then
MsgBox "You must enter a positive value in the first field!", 0, "Error"
Txt1.SetFocus
Else
Val(Tet1.Text) = Val(Txt1.Text)
If Val(Tet1.Text) <= 4 Then
Tet1.FontBold = True
Tet1.ForeColor = vbRed
Tet1.Text = Tet1.Text + &quot;*&quot;
Else
Tet1.FontBold = True
Tet1.ForeColor = vbBlack
End If
End If

 

Try...
[tt]
Tet1.Text = Val(Txt1.Text)
'or
Tet1.Text = Txt1.Text
[/tt]

Good Luck

 
Just Curious, but WHY would you want to do this? The DISPLAYED appearance will not change. Further, the actual type is not specified, so the function returns &quot;the appropiate type (in practice, I have only ever seen it return a DOUBLE unless it is returned to a previously dimensioned variable). While there is SOME latitude (protection?) for the entry of non numeric characters, it comes at the expense of setting the entry to 0 (for ALL non numeric characters) and NOT changing the type or truncating the returned value at the first non numeric character in hte text version. Any further use of the content of the entry could just as easily do the conversion and in some situations, it would be concerted automatically anyway.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top