Professional layout code problem
Firstly Merry Christmas everyone :D
I have been asked by a family member to create an application, but one thing that I have decided that I should do with this application is make the UI more professional.
Up to now I have been creating applications which when I need more information I would open up a new form, but I would like to create an application which all is within the main form.
After researching this I think the solution for this is to have the different bits in different panels and then only show the relevant panels at a particular time.
But the problem I am having is getting my head around the problem with all the code. Using the panels method all the code would be in the main form, which when you have only a small amount of code then that would be fine but I'm thinking that with a larger application would make that a little more difficult as you may have hundreds of different panels.
So while I will be using OOP, so there wouldn't be much business logic code on the form, there would still be a lot.
So I am wondering if anyone had any suggestions on how I should go about doing this, if I'm using the wrong method then I would like to know what the more appropriate method would be.
Thanks for any help in advance
Satal :D
Re: Professional layout code problem
you could use code regions to keep your code organized into 'regions'
vb Code:
Public Class Form1
#Region "panel1 code"
'put code related to panel1 in this region
#End Region
#Region "panel2 code"
'put code related to panel2 in this region
#End Region
end class
Re: Professional layout code problem
Yeah I love regions (I probably already use them too much). So I guess that its normal to just have lots of code in a form, and that is a quite normal way to have lots of content through one form.
Thanks :)
Re: Professional layout code problem
What is wrong with using multiple forms? Showing everything on a single form may be possible with small applications, but if it gets a little larger most applications really require multiple forms. And why shouldn't they?
Anyway, without more information on what your application should do, and how you want it to look, we can't really help you; we can't tell you how to design a user interface if we have no clue what it should do!
Re: Professional layout code problem
You can use controls aswell.
The problem with panels is that if you have 3 panels and you want to edit Panel1, you can't, you'd have to resize your form and "move away" Panel2 and Panel3 to get to Panel1.
When using controls, you can put all controls on the main form and edit them separately =).
*EDIT* This also solves your code problem :D
All controls can have their own Code.vb =)
Re: Professional layout code problem
The application is a piece of software that deals with keeping a record of children attending a school, when they're supposed to be attending, the government funding that the school receives for the child attending, and works out the amount that the parents need to pay for what the government funding doesn't cover.
Although while I am using this application as an opportunity for me to learn about how to create professional looking layout, I'm more interested in the actual methods suggested for creating large applications UI.
Like for example the controls suggestion by Zeelia, which I assume means making each of the different screens into a control and then put that on the form, I hadn't thought about that and that's something that I will have to look into further to see if that would be appropriate for what I want to do.
Re: Professional layout code problem
One thing to consider is that some controls can be replaced by other controls. Like, a bunch of buttons can be replaced by one dropdown list when a user right clicks. Or you could replace a few listviews or something by using a TabControl and put them in different tabs (unless you need to view them at the same time).
Just some things I learned when I started to focus on layout :)
Re: Professional layout code problem
While you may not have the time now, I would suggest you look at WPF. This new set of extensions to the .net framework allow you to really separate out the interface from the business code.
WPF uses a new language called XAML to control the interface, while XAML can seem "magical" at first, as if it doesn't follow a structure once you get the hang of how it works you will find that its "magical" features are little more than shortcut's that are designed to make functional and dynamic interfaces easier to work with.
Re: Professional layout code problem
Yes, XAML is really great and you get a wider option of layout and graphics with it.
For example, gradient colors which are great for buttons.
Re: Professional layout code problem
Quote:
All controls can have their own Code.vb =)
Another alternative is to use partial classes - you can separate logical groups of code into partial classes which at compile time all become part of the same class.
VB actually already uses this to keep the designer code separate from the user code.
Re: Professional layout code problem
If you are not keen on WPF I would at least second keystone paul's idea and split the design code into a partial class if at least for readability.
Re: Professional layout code problem
@keystone_paul, ooow I hadn't thought about that, yes that sounds like a good idea.
@DeanMc sounds like MVC for desktop applications, I will definitely have to look into this.
Thank you everyone for your suggestions they have been very useful, although if you do have any other suggestions then I will more than welcome them :D
Re: Professional layout code problem
Actually it is a different concept all together but once you get the hang of it you will understand why it is gaining popularity so fast!