all groups > vb.net controls > september 2005 >
You're in the

vb.net controls

group:

Multiple Form Application


Multiple Form Application Georg Weiler
9/13/2005 9:13:46 PM
vb.net controls:
Hi,

hope this is the right group for some kind of newby questions??

I'm developing a small app in VB.Net for my PDA. The user needs to run
through some consequitive forms, i.e select item from list in form 1 ->
get new selection (might be some gouped checkbox or list or) in form 2,
select item in this new list, get new list in form3 etc.

Now my question is: is it common in VB.Net to create a new form for each
step or change one existing list?

thanks for any help,
Re: Multiple Form Application Michael C#
9/13/2005 10:03:34 PM
Usually for just a few checkboxes and a couple of combo boxes I would put
them on the same form. If the value of one listbox/combo box depends on
another selection made in another combo box, I would disable the second
combo box until the user makes a selection in the first.

It really depends on what you're doing though. For a configuration,
registration or installation application it might make more sense to give
the user only one set of options per form.

[quoted text, click to view]

Re: Multiple Form Application Georg Weiler
9/14/2005 12:00:00 AM
Thanks Mike,

I try to give an example of what kind of app I have in mind. Let's
presume the system asks the user for the city he/she lives in. Form1
shows a list with continent names. Based on the selection, Form2 shows a
list of all countries in the selected continent, followed by Form3 which
offers a list of all cities in selected country in Form2 etc.

Of course could I fill the ListBox element with the corresponding items,
based on the users input. In that case, I would use only one form and
rebuild the ListBox every time. But if I do so, how can I distinguish in
which "level" of the workflow I am? What I mean by that is how do I know
that after selecting a city, the application should (as an example) open
a MsgBox, saying "You live in .....", instead of rebuilding the ListBox?

Since I come from a HTML/PHP background, in that environment I would set
a hidden variable (e.g. $citySelected=1) in the HTML form and after the
submit, I would check if this variable exist or not.

What is the common/usual/elegant way to do this in VB.Net?

Thanks again,
georg.


[quoted text, click to view]
Re: Multiple Form Application Michael C#
9/25/2005 3:57:48 PM
For what you're doing I would set them all in the same form. Just populate
and enable each combobox/list as you select the option above it. For
example, the Countries combobox would not be enabled until I select the
Continent. The States/Territories will not be enabled until I select a
Country; etc.

You would use the SelectionChanged event handlers for each combobox to
populate/enabled the next combobox. You can think of it in terms of a DHTML
registration form that works similarly; in that case you would use
JavaScript/VBScript/etc. to populate each combobox based on a previous
selection, without re-directing to a new page.

If you decide you want to do one combobox/set of options per form, however,
you can declare a set of variables at Module level to maintain the state
between forms. Or you could declare a Public Shared variables in your forms
and access them from the other forms; or even declare a class with Public
Shared variables making them accessible to all forms.


[quoted text, click to view]
AddThis Social Bookmark Button