Click here to Skip to main content
12,394,769 members (72,022 online)

Calling a Sub from another sub within same class

Travis Singh asked:

Open original thread
Hi. I have 2 questions here regarding classes and Subroutines. I am a noob at vb still and pls excuse my stupidity Smile | :)

I hope u can help me


I have 2 Subroutines in the same Class:
Public Sub DataCapture(ByVal PAGE As Integer, MOTOR As String)
 
 If PAGE = 1 Then
 
 End If
 .
 .
 .
 .
 .
 .
 .
 
PAGE = 12
 
End Sub
 
Private Sub MotorCheck()
 
 If DataCapture.Motor = 1 Then
 
 End If
 .
 .
 .
 .
 .
 
 DataCapture.Motor = 12
 
End Sub





My First Question :

is it correct to access the DataCapture's MOTOR variable by simple calling DataCapture.Motor

My Second Question

I want to run the Private Sub In every if statement of the public sub. How do i to this since they are both in the same class


That Is all. I hope you can help me, it is greatly appreciated!

Travis
Tags: VB, VB.NET

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100