B
Beeawwb
Hi everybody,
I've got a module I wrote a while ago, and I had an idea to rewrite a
portion of my code to make it more portable. Trouble is, now that I sit down
to actually do it, I realise that it may be a bit trickier than I first
thought.
My original code is called by another portion of my code, which has run a
lot of initialisation settings for the module. This is run just before
calling a form, so that I can assign values to the form buttons. (Eg
Button1.Label = TrayLabels(1))
Sub AssignTrays()
'Add new printers here
Select Case Printername
Case "PSA075"
TrayLabels = Array("Blank", "Blank", "Blank", "A3")
Case "PSA073"
TrayLabels = Array("Blank", "A3", "SG", "CG")
Case "PSA032"
TrayLabels = Array("Blank", "SG", "CG", "A3")
Case "PSA071"
TrayLabels = Array("Blank", "SG", "CG", "NR")
End Select
End Sub
The code works fine and I've had no issues. However, a drawback to this
style was noted yesterday when we got a new printer, with new tray
assignments. Instead of being able to quickly change the labels, I had to
wait until everybody had gone home and deploy a new version, just to change 1
label. That's when the idea of using an Ini file to get printer names and
tray names occurred to me.
What I'd like to do is create an Ini file which contains
A) Get a list of available printers for a site.
B) A list of what trays are available for these printers.
E.g.
[AvailPrinters]
PSA071
PSA073
PSA075
PSA032
[PSA071]
Blank
SG
CG
NR
The main problem is, I don't know how to read multiple values with
System.PrivateProfileStrings, only a single value. Does anybody have any idea
how I might set about trying to code this?
Thanks in advance,
Bob
I've got a module I wrote a while ago, and I had an idea to rewrite a
portion of my code to make it more portable. Trouble is, now that I sit down
to actually do it, I realise that it may be a bit trickier than I first
thought.
My original code is called by another portion of my code, which has run a
lot of initialisation settings for the module. This is run just before
calling a form, so that I can assign values to the form buttons. (Eg
Button1.Label = TrayLabels(1))
Sub AssignTrays()
'Add new printers here
Select Case Printername
Case "PSA075"
TrayLabels = Array("Blank", "Blank", "Blank", "A3")
Case "PSA073"
TrayLabels = Array("Blank", "A3", "SG", "CG")
Case "PSA032"
TrayLabels = Array("Blank", "SG", "CG", "A3")
Case "PSA071"
TrayLabels = Array("Blank", "SG", "CG", "NR")
End Select
End Sub
The code works fine and I've had no issues. However, a drawback to this
style was noted yesterday when we got a new printer, with new tray
assignments. Instead of being able to quickly change the labels, I had to
wait until everybody had gone home and deploy a new version, just to change 1
label. That's when the idea of using an Ini file to get printer names and
tray names occurred to me.
What I'd like to do is create an Ini file which contains
A) Get a list of available printers for a site.
B) A list of what trays are available for these printers.
E.g.
[AvailPrinters]
PSA071
PSA073
PSA075
PSA032
[PSA071]
Blank
SG
CG
NR
The main problem is, I don't know how to read multiple values with
System.PrivateProfileStrings, only a single value. Does anybody have any idea
how I might set about trying to code this?
Thanks in advance,
Bob