Jasin
Jasin

Reputation: 425

Methods best practice - VB.NET

I have a program that is getting pretty big and it is a pain to find everything through all the functions and classes.

I am trying to break it up into other files based on their method.

Some of these functions have calls to others in the main class. I changed most my functions from private to public to access this. I had problems calling certain code created windows so importing mainwindow helped that.

My last problem is editing the mainwindow ui from one of the module files. I want to make sure im on the right page before i continue breaking it up. My only guess is that anything they updates the ui should be left on the main class.

Thanks

Upvotes: 0

Views: 430

Answers (2)

Justin Morgan
Justin Morgan

Reputation: 2435

A couple options:

  1. Use callbacks into the your main window.
  2. Create events for when you need the form updated. Your program logic raises the events, and your main window class can consume them.

Upvotes: 1

SLaks
SLaks

Reputation: 887777

The only code in your form class should be code that talks to other classes and updates the UI based on data from other classes.

Depending on your application, the form class might handle change events from other classes to update the UI or pass user input to other classes in Change or Click events.

Upvotes: 1

Related Questions