|
| ||||||||||
| Tags: form display, php, user choice, vb form, visual basic |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Display form in VB based on user's choice
|
|
#2
| |||
| |||
| Re: Display form in VB based on user's choice
You can create your Form Generic. And when you call, depending on what the user click you do not load the same data. As you'll say that my answer makes sense (to logical question), I anticipate: I guess: - Your list will contain lines that come from your database. - So you have to load your data into a dataset - This dataset will be the source of your DataGrid that will display lines - Depending on the call button, and well you use it the same query to populate the dataset. - And for your functions Add, Edit, etc. well if you're making based on the case. |
|
#3
| ||||
| ||||
| Re: Display form in VB based on user's choice
For the most part call and make a parametrized constructor; if the form differs value as an identifier you pass; if the function changes depending on the type of form you can use an enum Examples for the 2 cases Code: public sub new (Id as long) initiliazecomponent ' treatment by id for managing display end sub Code: public enum TypeOpen
add = 1
modify = 2
end enum
public sub new (open as TypeOpen)
select case open
case add
' layout for the add
case modify
' layout for the modify
end select
end sub |
|
#4
| ||||
| ||||
| Re: Display form in VB based on user's choice Quote:
Quote:
Quote:
- Left: the list (eg processors) - Right: 3 buttons (Add, Modify, Delete) Quote:
|
|
#5
| ||||
| ||||
| Re: Display form in VB based on user's choice
Usefulness is to appoint an integer value, that avoids coding errors and that makes the code readable. Imagine your form or you have your requests in 3 variables Code: private _RqRam as string = "select * from ram" private _RqProcessors as string = "select * from processors" private _RqCms as string = "select * from cms" Code: public sub new (typeopen as integer)
select case typeopen
case 1
mycmd.commandtext = _rqram
case 2
mycmd.commandtext = _rqprocessors
case 3
mycmd.commandtext = _rqcms
end select
' execution of the application and filling datagrid
end sub Code: dim f as new frmdisplayPieces(1) f.show Code: public enum TypeOpen as integer
ram = 1
processors = 2
cms = 3
end enum
public sub new (typeopen as TypeOpen)
select case typeopen
case ram
mycmd.commandtext = _rqram
case processors
mycmd.commandtext = _rqprocessors
case cms
mycmd.commandtext = _rqcms
end select
' execution of the application and filling datagrid
end sub Code: dim f as new frmdisplayPieces(ram) f.show |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Display form in VB based on user's choice" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create a user control form in Excel 2010 | --MasseySian-- | Software Development | 3 | 06-09-2012 07:03 PM |
| Need help to create a login user form in Microsoft Excel | Henriksen | MS Office Support | 2 | 23-02-2012 05:04 PM |
| Drupal : Add new fields in the form of user / register | Arrosa | Software Development | 6 | 05-01-2011 04:11 AM |
| Unable to display value in asp.net form | Juaquine | Software Development | 4 | 01-02-2010 08:12 PM |
| Thunderbird : display of attachments in list form | Beter 2 Burn Out | Technology & Internet | 4 | 30-03-2009 03:40 PM |