开发者

Accessing a property in Visual Basic as opposed to C#

开发者 https://www.devze.com 2022-12-22 02:26 出处:网络
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 proj

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消