user2423014
user2423014

Reputation:

My.Settings.save issue in Visual Basic

i hvave created a string in my Settings area called DBUsername , it is a string , there is no value.

in my code I have

    Dim Setting As New My.MySettings
Private Sub saveButton_Click(sender As Object, e As EventArgs) Handles saveButton.Click

    If TextBox1.Text <> "" Then
        name = TextBox1.Text
        Setting.DBUsername = name '(ERROR IN THIS LINE : the property DBUsername  is Read Only )`
        Setting.Save()
    End If
End Sub

Upvotes: 0

Views: 3378

Answers (1)

tgolisch
tgolisch

Reputation: 6744

In the Project Settings editor (in Visual Studio) the "Scope" of your DBUsername property needs to be set to "User". "Application" scoped properties are read-only.

Upvotes: 2

Related Questions