Click here to Skip to main content
15,908,445 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i declare these 2 variables for usin function

What I have tried:

then i use these like this



now i want also call parallelLines4 how i call this one in above function?
Posted
Updated 23-May-16 19:13pm
v3

1 solution

The indentation of the new declaration compared with the old, and the word "usin" implies it might be within a method rather than outside. If so, then the variable is only available within the method - it goes out of scope at the end of the method and cannot be accessed in any other method.
VB
Dim parallelLines3 As New List(Of PointLatLng)
Public Sub MyMethod()
    Dim parallelLines4 As New List(Of PointLatLng)
    ... parallelLines3 and parallelLines4 available here
End Sub
Public Sub MyOther Method()
    ... parallelLines3 available here
    ... parallelLines4 not available here
End Sub
In addition, if you are declaring it as part of a Using block, then it is only available within the block - once it ends, it can't be accessed again.
VB
Public Sub MyOther Method()
    Using parallelLines4 As New List(Of PointLatLng)
        ... parallelLines4 available here
    End Using
    ... parallelLines4 not available here
End Sub
 
Share this answer
 
Comments
super_user 23-May-16 3:55am    
"usin" this is "using"..
super_user 23-May-16 3:56am    
..
OriginalGriff 23-May-16 3:59am    
But where do you declare parallelLines4?
super_user 23-May-16 4:04am    
first i write this ... Dim parallelLines3 As New List(Of PointLatLng)
Dim parallelLines4 As New List(Of PointLatLng)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900