Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 1st, 2004, 08:25 AM
Authorized User
 
Join Date: Jun 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default AS Clause on Functions VB.Net

Hi

In vb.Net why does option strict require all functions to have an 'AS' clause. What if I don't need to return anything?

Example:
Public Function Add(byval Name as string) AS "What should this be?"

Try
       'code to call insert, update or delete stored procedure, no return values
catch sql exception
       messagebox.show (ex.message)
end try

end function

Duncan
__________________
Duncan
 
Old May 1st, 2004, 08:38 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

A VB function must return something. A Sub does not.

Public Sub Add(byval Name as string)
   Try
       'code to call insert, update or delete stored procedure, no return values
   catch sql exception
       messagebox.show (ex.message)
   end try
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you use Functions in VB? loli Beginning VB 6 2 March 4th, 2008 05:12 PM
VB WHERE clause for Recent Values Rich57 ASP.NET 2.0 Basics 2 February 21st, 2008 01:11 PM
acessing DLL functions in VB Scripting seeekvb VBScript 5 January 15th, 2007 06:58 PM
Inline functions in VB.NET ashu_from_india VS.NET 2002/2003 2 February 24th, 2005 09:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.