Apoorv Apoorv - 5 months ago 26
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

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

https://msdn.microsoft.com/en-us/library/ms173136.aspx

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.