Dev Dex

developer goals

Category Archives: windows form development in c#.net

Severity Code Description Project File Line Suppression State Error Cannot open ” The requested operation cannot be performed on a file with a user-mapped section open.

Sometimes visual studio throw this error because it cannot open dll file to write. I fixed this issue by deleting the dll file in the debug folder. You might not be able to delete the file by going to the debug folder there it has to be deleted from Command Prompt forcefully.

  • Open Command Prompt in Admin mode
  • Navigate to debug folder like cd ‘c:\my source code\project\bin\debug\’
  • then del /f fillname

Thank you

How to access windows form controls from another Form.

let suppose you have two windows forms open.

1st is frmRegistration

2nd is frmLogin

suppose there is Label control on the registration form named as lblIsRegistered and you want to access this control on the Login form.

firstly, you need to go into the properties of the lblIsRegistered label and check its Access modifier which will be private by default.

just make it Public.

secondly, on the login form make object of registration form like

frmRegistration registrationForm = new frmRegistration();

then access its public control e.g. String isRegisterCheck =  registrationForm.lblIsRegistered.Text;

Thank you very much