Accessing a property in Visual Basic as opposed to C#
The C# code is:
DataContext db = new DataContext(MyProject.Properties.Settings.Default.MyString)
I am trying to convert this app to VB.NET but VB.NET does not seem to have a .Properties on the project. I am probably confused about what that C# is actually doing. I assumed it was trying to get the string out of the app.config (both versions have the same app.config) or out o开发者_如何学Cf Settings.settings in the Properties folder.
Visual Basic does not have a properties folder though, only a My Project folder.
Any ideas? I am using Visual Studio 2010.
You are almost there. When you add a new setting, you can get access to it my going to My.MySettings.Default.MyString
in Visual Basic.
You can try My.Settings , that is what I seem to be using in VB.Net currently.
精彩评论