functions in the class file

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2007
Posts: 1
Reputation: elvy2000 is an unknown quantity at this point 
Solved Threads: 0
elvy2000 elvy2000 is offline Offline
Newbie Poster

functions in the class file

 
0
  #1
Sep 7th, 2008
  1. i have writen a function in the vb class file and i am trying to read the function form the asp.net but it is showing an error Error 13 Reference to a non-shared member requires an object reference. can you help please i am new to this subject
  2.  
  3. elvin
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: functions in the class file

 
0
  #2
Sep 7th, 2008
Hi,
From the Error, I think you are calling that Function without creating an Instance. For example Consider the Class
  1.  
  2. Public Class A
  3. Public Sub Show()
  4.  
  5. End Sub
  6. End Class

This can be called as
  1. Dim Obj as A
  2. Obj = New A()
  3.  
  4. Obj.Show()
  5.  
  6. 'But not
  7. A.Show()

If you want access Show regardless of the Class use Shared keyword make it shared among all the instances.

  1.  
  2. Public Class A
  3. Public Shared Sub Show()
  4.  
  5. End Sub
  6. End Class
  7.  
  8. A. Show()

This may helpful or You can show your class and Function calling.
Last edited by selvaganapathy; Sep 7th, 2008 at 9:26 pm.
KSG
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC