views:

25

answers:

1

the code below is showing error after return statement

Private Sub Command1_Click()
Dim str As String
str = display("test")
MsgBox (str)

End Sub



Public Function display(s As String) As String
 s = "updated"
 Return s
 End Function

thanks in advance

+1  A: 

Change display function. The difference is that in vb6 functions return a value not with return, but with it's name(in this case display), like below.

   Public Function display(s As String) As String 
       s = "updated" 
       display = s 
   End Function
hgulyan