Apoorv Apoorv - 1 year ago 94
Vb.net Question

C# equivalent for these VB statements

I am looking for the C# alternatives for these statements which were in VB and have been converted to C# using Telerik online convertor . The compiler gives error as it is unable to identify these statements.

  • My.Settings.Reload();

  • My.Settings.MainScreenLeft = Me.Left

  • My.Settings.MainScreenTop = Me.Top

  • My.Settings.MainScreenWidth = Me.Width

  • My.Settings.Save()

  • My.Settings.Mode = CboMode.SelectedItem.ToString

Answer Source

There's no direct translation for My in C#. This link gives details on using VB's My class in C#:


Since you're trying to access the settings of the project using Settings, try replacing My.Settings. in your statements with Properties.Settings.Default.. Ensure the properties you're accessing (like MainScreenTop) exist as settings in the project's properties.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download