RIAS
asked on
Code enhancement
Hi,
is there a better way of writing this piece of code:
is there a better way of writing this piece of code:
Private Sub LoadDataInvoiceFields()
Select Case StrPayTypeSpPayProc
Case 1
txtAccInv.Text = StrGrossValueSpPayProc
Case 2
txtHotelInv.Text = StrGrossValueSpPayProc
Case 3
txtFoodBevInv.Text = StrGrossValueSpPayProc
Case 4
txtLaundryInv.Text = StrGrossValueSpPayProc
Case 5
txtParkInv.Text = StrGrossValueSpPayProc
Case 6
txtPhone.Text = StrGrossValueSpPayProc
Case 7
txtMisInv.Text = StrGrossValueSpPayProc
End Select
ASKER
is my code fine?
Can the repetion like
= StrGrossValueSpPayProc
be avoided?
Can the repetion like
= StrGrossValueSpPayProc
be avoided?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry I'd not looked closely enough. Ignore my previous comment.
The select...case is probably your best option, it really depends on how your form is designed and if you do have all seven textboxs.
The select...case is probably your best option, it really depends on how your form is designed and if you do have all seven textboxs.
ASKER
Cheers!
txtAccInv.Text = StrGrossValueSpPayProc