开发者

How to get the value from method in Visual Basic 6

开发者 https://www.devze.com 2022-12-30 16:11 出处:网络
The code below returns error after the return statement Private Sub Command1_Click() Dim str As String str = display(\"test\")

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

精彩评论

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

关注公众号