Click to See Complete Forum and Search --> : Changing Views?


Ctwizzy
February 7th, 2005, 06:29 PM
Ok so im new to Windows Programming so if i word this wrong or this is really a simple question I apologize. Everywhere I turn people get confused or I cant find an answer.

Ok so right now I have my application like so


File Options1 Options2
---------------------------------------------------

display stuff


---------------------------------------------------

Now basically its a form with a menu and the main page. Now when they click in options 2 and select "Add user" I want the display information to be replaced by the Add user view. I hope this makes sense. Now I was going to just make another form, but then that means replicating the menu bar and thats a waste because id have to retype twice.

So im looking for a way to switch the screens as a menu option is picked, do I do this via a new form or what?

Thanks

darwen
February 7th, 2005, 11:13 PM
It's usual to do this sort of thing in a seperate dialog form.

I.e. a form which you 'ShowDialog' on.

It is possible to switch views as your suggesting - I'm not sure whether it's necessary to go to that level of complexity though.

Darwen.

Ctwizzy
February 8th, 2005, 01:00 AM
Darwen can you explain or show an example or something of the easy way then. I dont really understand seperate dialog forms? If the way im asking is too complex can you show me how I should do it?

Thanks.

Norfy
February 8th, 2005, 01:52 AM
Hi Ctwizzy,

here's is another link to add to your collection: UI Patterns and Techniques (http://time-tripper.com/uipatterns/index.php)

Ctwizzy
February 8th, 2005, 08:21 AM
Yes this website is in my list allready thanks lol.

Still looking for the solution to present different data from a different selection...

Norfy
February 8th, 2005, 08:40 AM
Whether this is the way to go is another matter, it all depends on your other options.

But, in direct answer to your request "I want the display information to be replaced by the Add user view"...

Rather than a Form put the controls for display info and "add user view" into UserControls.

You can then use a tabbed control in the main Form eg. Card Stack (http://time-tripper.com/uipatterns/index.php?page=Card_Stack) and place each user control on a separate tab.

Or you can switch controls manually by adding all the user controls to your Form and setting the Visible property appropriately.

Krzemo
February 8th, 2005, 08:56 AM
Rather than a Form put the controls for display info and "add user view" into UserControls. Yes, I'm using that kind of "UserControls" and I have already 2 year expirience with it.
From my expirience I can tell: it works perfect!

Best regards,
Krzemo.

Ctwizzy
February 8th, 2005, 10:26 AM
I am a C#, make that Windows Programming novice. I have heard of user controls, tho no idea how/when to use or how to make them change the view. Could you show me and example, or walk me through the steps. Or if there is a tutorial somewhere?

Thanks

Ctwizzy
February 8th, 2005, 01:01 PM
Im using this example to learn user controls

http://www.codeguru.com/forum/newreply.php?do=newreply&noquote=1&p=1091866

problem is, it jumps steps. So I have created my user control is a userControlLibrary, then it says add the dll.

Problem is it shows no way of creating this dll?

So I have a user control with 2 labels and a timer on it which displays the date and time. I want to include this user Control on my main application, but I dont know how now, so if someone could help please.

Also someone above said I can use user Controls to control which view is being shown to users. How would I go loading and unloading the user controls as a button is pressed??

Thanks

Ctwizzy
February 8th, 2005, 05:02 PM
Ok I built the control, and then referenced the dll in the bin dir.
So now I have my control working.

Can anyone tell me how to hide and show controls?

Krzemo
February 9th, 2005, 12:10 AM
MyControl.Visible=false;

Ctwizzy
February 9th, 2005, 12:27 AM
And this is the way I should be switching what information the user sees based on their selections?

Norfy
February 9th, 2005, 01:55 AM
Which tools are you using to build your app? Notepad or VisualStudio?

Building apps without a proper IDE will be painful. Here's a free one: SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/).

And this is the way I should be switching what information the user sees based on their selections?It's one way. If you want consistency, simply look at how other existing apps work.

Krzemo
February 9th, 2005, 02:21 AM
And this is the way I should be switching what information the user sees based on their selections?Yes. As Norfy already mention it:
You can then use a tabbed control in the main Form eg. Card Stack (http://time-tripper.com/uipatterns/index.php?page=Card_Stack) and place each user control on a separate tab.

Or you can switch controls manually by adding all the user controls to your Form and setting the Visible property appropriately.
So 1 of solution is to change Visible property of your controls placed in your form inside captured event (for ex: If user checked Checkbox than one of the controls will appear, if unchecked it will get hidden)

2nd solution is to place controls on tabcontrol and change tabcontrol index.

Hope it Helps.