hi
this is zaid ahmed my query is if person is declared a global variable and second local variable with a funtion with same in parent class so does this work. does anyone there to help me

If you declare a variable in a function that has the same name as a global variable then the local variable masks or overrides the global one. If you need to reference the global variable from within the function you can refer to it as Me.varname.

Public Class Form1

    Private s As String = "global"

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Dim s As String = "local"

        MsgBox(s)        'local variable
        MsgBox(Me.s)     'global variable

    End Sub

End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.