why are my public functions not accessible.

I am writting a wp7 app that has 2 pages (MainPage and Setttings).  I am using a couple of public functions  (AllowNumbersAtStart and AllowSymbolsAtStart) that I have placed in a class  called AppSettings.  For some reason I can only accesss them from Settings.xaml.vb and not MainPage.xaml.vb.  What am I missing?  I thought this would work like normal VB.Net.  I have tried for ex. AllowNumbersAtStart and AppSettings.AllowNumbersAtStart.
Imports System.IO.IsolatedStorage
Imports System.Diagnostics
Imports System.Collections.Generic


Public Class AppSettings
    Dim isolatedstore As IsolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings 'get the settings for the app.

    Public Sub AppSettings()

    End Sub

    Public Function GetValueOrDefault(ByVal key As String, ByVal defaultValue As ValueType) As ValueType
        Dim value As ValueType

        Try
            'value = DirectCast(isolatedstore(key), ValueType)
            value = CType(isolatedstore(key), ValueType)
            'value = isolatedstore.TryGetValue(key, defaultValue)
        Catch ex As KeyNotFoundException
            value = defaultValue
        Catch ex As ArgumentException
            value = defaultValue
        Catch ex As NullReferenceException
            value = defaultValue
        End Try
        Return value
    End Function

    Public Function AddOrUpdateValue(ByVal key As String, ByVal value As Boolean) As Boolean
        Dim valueChanged As Boolean = False

        Try
            'if new value is different. set the new value.
            If CBool(isolatedstore(key)) = value Then
                isolatedstore(key) = value
                valueChanged = True
            End If
        Catch ex As KeyNotFoundException
            isolatedstore.Add(key, value)
            valueChanged = True
        Catch ex As ArgumentException
            isolatedstore.Add(key, value)
            valueChanged = True
        Catch ex As NullReferenceException
            isolatedstore.Add(key, value)
            valueChanged = True
        Catch ex As Exception
            MessageBox.Show("Exception while using IsolatedStorageSettings " & ex.Message)
        End Try

        isolatedstore.Save()

        Return valueChanged
    End Function

    Public Property AllowNumbersAtStart() As Boolean

        Get
            Return CBool(GetValueOrDefault("AllowNumbersAtStart", False))
            'Return CBool(isolatedstore.TryGetValue(AllowNumbersAtStartkeyName, AllowNumbersAtStartDefault))
        End Get
        Set(value As Boolean)
            AddOrUpdateValue("AllowNumbersAtStart", value)
        End Set
    End Property

    Public Property AllowSymbolsAtStart() As Boolean
        Get
            Return CBool(GetValueOrDefault("AllowSymbolsAtStart", False))
            'Return CBool(isolatedstore.TryGetValue(AllowNumbersAtStartkeyName, AllowNumbersAtStartDefault))
        End Get
        Set(value As Boolean)
            AddOrUpdateValue("AllowSymbolsAtStart", value)
        End Set
    End Property

End Class

Open in new window

NevSoFlyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NevSoFlyAuthor Commented:
By the way the error that I get when trying to call the function from MainPage.xaml.vb is :
'AllowNumbersAtStart' is not declared. It may be inaccessible due to its protection level.

I know the answer will be a stupidly simple one but I just don't see it.
0
käµfm³d 👽Commented:
You would use AppSettings.AllowNumbersAtStart if you had declared the AllowNumbersAtStart method to be Shared. What you need to do is declare an instance of you class (or mark it Shared if you want to keep the aforementioned syntax). For example:

Dim appSet As New AppSettings()

appSet.AllowNumbersAtStart()

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NevSoFlyAuthor Commented:
Totally embarrassed here.  I will blame it on only 2 hrs sleep in over 30 hrs and just looking at the same screen too long.  Thx.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.