Click here to Skip to main content
15,918,243 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How do I pass an array of strings from VB6 to .NET? Pin
ordepavlis24-Mar-03 22:16
ordepavlis24-Mar-03 22:16 
Generalcontrol array in VB.net Pin
pradipta21-Mar-03 1:44
pradipta21-Mar-03 1:44 
GeneralRe: control array in VB.net Pin
Poolbeer21-Mar-03 2:53
Poolbeer21-Mar-03 2:53 
QuestionThe application developed in VB.Net can use menu with unicode in Windows 98? Pin
nguyentuancuong20-Mar-03 14:28
nguyentuancuong20-Mar-03 14:28 
QuestionWhat am I doing wrong with Public? Pin
David Williams20-Mar-03 10:36
David Williams20-Mar-03 10:36 
AnswerRe: What am I doing wrong with Public? Pin
Danny Blanchard20-Mar-03 12:43
Danny Blanchard20-Mar-03 12:43 
GeneralRe: What am I doing wrong with Public? Pin
David Williams20-Mar-03 13:52
David Williams20-Mar-03 13:52 
GeneralRe: What am I doing wrong with Public? Pin
Danny Blanchard20-Mar-03 15:52
Danny Blanchard20-Mar-03 15:52 
David Williams wrote:
The Public keyword in the Dim statement declares elements to be accessible from anywhere within the same project

That's true if the element is global, but you forgot about how scope works. An element declared within a class is not global, but if declared as public can be accessed outside of the class. In order to do that you must reference the class.

For example:
You have a global variable declared in your project:

Public Var1 As Integer 'Global, accessable anywhere in the program

Then you have a class that can use that variable:

Public Class TestClass1<br />
<br />
Public Var2 As Integer    'Accessable from outside the class<br />
Private Var3 As Integer    'Accessable only in the class<br />
<br />
Public Sub MyProc()<br />
Dim Var4 As Integer          'Accessable only in this method<br />
Var4 = Var3 'This is OK because Var3 can be accessed anywhere in the class<br />
End Sub<br />
<br />
Private Sub MyProc2()    <br />
Dim Var5 As Integer           'Accessable only in this method<br />
Var5 = Var1 'This is OK because Var1 can be accessed from anywhere.<br />
End Sub<br />
<br />
End Class


If you have a global instance of that class:

Public TestClassObj as TestClass1

Then you can access public data inside that class:

Public Class TestClass2<br />
<br />
Private Var6 As Integer<br />
<br />
Public Sub DoSomething()<br />
  Var6 = TestClass1Obj.Var2 'This is OK because TestClass2 has indentified where Var2 can be found<br />
End Sub<br />
<br />
End Class


So, the VB doc you mentioned was correct, but you have be carefull where you declare your elements and always mind program scope.

Daniel E. Blanchard
Generalcreating dll Pin
pnpfriend20-Mar-03 5:38
pnpfriend20-Mar-03 5:38 
GeneralRe: creating dll Pin
Ray Cassick20-Mar-03 7:39
Ray Cassick20-Mar-03 7:39 
GeneralVB6 Mousepointer property Pin
Andy H20-Mar-03 1:09
Andy H20-Mar-03 1:09 
QuestionHow do you print a project in NET Pin
David Williams19-Mar-03 10:13
David Williams19-Mar-03 10:13 
GeneralCreating Activex Control in VB.Net Pin
Hari 200919-Mar-03 6:30
Hari 200919-Mar-03 6:30 
GeneralAccessing dll's using VB Pin
Sudar Muthu19-Mar-03 0:06
Sudar Muthu19-Mar-03 0:06 
GeneralUser authentication in Windows Forms Pin
RobertDempsey18-Mar-03 2:02
RobertDempsey18-Mar-03 2:02 
GeneralRe: User authentication in Windows Forms Pin
DxSolo26-Mar-03 3:30
DxSolo26-Mar-03 3:30 
GeneralSelct from Multiple Access mdb's Pin
Marc Hennebery17-Mar-03 18:43
Marc Hennebery17-Mar-03 18:43 
GeneralRe: Selct from Multiple Access mdb's Pin
Danny Blanchard17-Mar-03 19:11
Danny Blanchard17-Mar-03 19:11 
GeneralRe: Selct from Multiple Access mdb's Pin
Marc Hennebery17-Mar-03 19:29
Marc Hennebery17-Mar-03 19:29 
GeneralAccessing an Imagelist in VB.NET Pin
dgwood17-Mar-03 5:40
dgwood17-Mar-03 5:40 
GeneralRe: Accessing an Imagelist in VB.NET Pin
Danny Blanchard17-Mar-03 14:20
Danny Blanchard17-Mar-03 14:20 
GeneralRe: Accessing an Imagelist in VB.NET Pin
dgwood17-Mar-03 14:37
dgwood17-Mar-03 14:37 
GeneralTranslate VB Function -> C++ Pin
mduarte16-Mar-03 9:33
mduarte16-Mar-03 9:33 
QuestionCould you tell me how to kill a existing process from another program ? Pin
DengJW13-Mar-03 22:09
DengJW13-Mar-03 22:09 
AnswerRe: Could you tell me how to kill a existing process from another program ? Pin
Hesham Amin14-Mar-03 1:21
Hesham Amin14-Mar-03 1:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.