DshWinchester Posted April 5, 2011 Author Share Posted April 5, 2011 I have a wrong idea about it.For me it's like 'Sub' was just for one 'Index'Can anyone sayfor example> **Public Sub/Sub** MyClass1(byval Index as long)> if getplayerclass(index)=1 then> playermsg index,"You got mojo",blue> else> playermsg index,"You damn gay",pink> end if Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 6, 2011 Share Posted April 6, 2011 Public Sub means that the sub can be called from any module, for example:```Public Sub xyz()End SubPrivate Sub zyx()End Sub```If I went to another module and called Sub xyz, that would work, but I wouldn't be able to call Sub zyx if I went to another module. Link to comment Share on other sites More sharing options...
DshWinchester Posted April 6, 2011 Author Share Posted April 6, 2011 Oh,so Private is just for the module that has itPublic is for allthen> "Public Sub MyClass(byval Index as long)"is the same thing than> "Sub MyClass(byval Index as long)"? < without 'Public'or> 'Sub MyClass'is the same thing as> 'Private Sub'? .-.thanks soul.as always hellping people Link to comment Share on other sites More sharing options...
Lavos Posted April 6, 2011 Share Posted April 6, 2011 -The Public keyword allows you to declare variables and procedures that are visible outside that code module, form, or class.-The Private keyword allows you to declare variables and procedures that are not visible outside that code module, form, or class, but are visible only within the current scope. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 6, 2011 Share Posted April 6, 2011 The default is public if you omit the prefix. For Subs, the Public keyword is used for clarity.You can find more information here: http://www.vb6.us/tutorials/vb-file-structure-and-scope Link to comment Share on other sites More sharing options...
DshWinchester Posted April 6, 2011 Author Share Posted April 6, 2011 thanks both '-' Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now