locked
Rookie Question... RRS feed

  • Question

  • Hello, 

    First, I'm not asking for anyone to write any code for me, just need a pointer on a good place to learn more about this. 

    I have a forms app with many tabs, each tab has it's own purpose. I have pulled most of the code off to a class per tab to handle DB lookups, etc, which then pass info back to the form... but my struggle is that for the life of me I can't figure out how to control the form directly from inside the class. I wouldn't worry a ton about it, but my .cs file for the form is getting out of control pretty quickly and I'm only done with 2 of the tabs.

    I tried searching some things, but am coming up blank. Any push in the right direction would be helpful. 

    -Zeph


    -Tim

    • Moved by CoolDadTx Friday, April 3, 2015 2:45 PM Winforms related
    Thursday, April 2, 2015 8:11 PM

Answers

  • Zephree,

    Turn around and start another way of thinking. The program is not controlling what happens. The end user is doing that. Therefore are created events, which can be handled by methods. To those methods can be added all kind of handlers who handle those events.

    Inside a method a class can be instanced to do what should be done.

    To see this happen drag a button on your form and double click on that. Now look in the program.designer.cs code what has happened.

    VB users have first to set Show All Files in top of Solution explorer to see that. VB misses already 13 years parity with C# for that.

     


    Success
    Cor

    • Marked as answer by Carl Cai Sunday, April 12, 2015 7:47 AM
    Saturday, April 4, 2015 8:36 AM

All replies