开发者

How to get the value from method in Visual Basic 6

The code below returns error after the return statement

Private Sub Command1_Click()
  Dim str As String
  str = display("test")
  Msg开发者_开发知识库Box (str)
End Sub

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

Any ideas why?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜