I’m creating a WinForm application in C# and one of its functions is displaying text in text boxes. I’m coding the logic for querying a database in a separate class and am unable to access the text box element in the class I’m creating (I’m getting a “name” does not exist in the current context error). Do I put all of my form logic into my Form1.cs file?
Share
You should try to keep your display logic separate from the rest of the application – the simplest thing to do is have the form class handle getting/setting form values. This means your data access component will query the database and the form will have to map the output to something that can be displayed e.g.