Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DropListBox option comes up as numeric value instead of String 1

Status
Not open for further replies.

tedb13

Technical User
Jan 20, 2011
41
CA
Can anyone explain why the selected string from a list is displayed as the number for which the string is found in the list? example: user selects "09:00", the value returned is 2, where "08:00" is at 0 in the list. I tried using real time values with a For/Next loop n an array, and it displayed as expected in the list, but came back displaying the the number in the list for which it is located,still. I want it to display the string selected, 09:00.

Any assistance would be appreciated. Thank you.
Code:
HOTD="08:00"&CHR$(9)&"08:30"&CHR$(9)&"09:00"&CHR$(9)&"09:30"&CHR$(9)&"10:00"&CHR$(9)& _

"10:30"&CHR$(9)&"11:00"&CHR$(9)&"11:30"&CHR$(9)&"12:00"&CHR$(9)&"12:30"&CHR$(9)& _

"13:00"&CHR$(9)&"13:30"&CHR$(9)&"14:00"&CHR$(9)&"14:30"&CHR$(9)&"15:30"&CHR$(9)& _

"16:00"&CHR$(9)&"16:30"&CHR$(9)&"17:00"'Hours of the day




    Begin Dialog dlgOptwo 88, 26, 193, 159, "This DIalog", .SMail

              ButtonGroup .ButtonPressed

       OkButton  128, 4, 50, 14, .btnOK

       CancelButton  128, 20, 50, 14, .btnCancel

       PushButton  130, 34, 44, 9, "&Reset"

       DropComboBox  6, 19, 73, 14, NameSelect(), .DCB1

       Text  6, 4, 73, 11, "Select REP"

       GroupBox  7, 44, 185, 76, "Group"

       TextBox  6, 142, 187, 15, .TB1

       Text  4, 129, 75, 10, "Additional Info:"

       TextBox  72, 51, 108, 15, .TB2

       Text  132, 74, 15, 9, "and"

       Text  72, 72, 26, 8, "between"

       DropListBox  102, 73, 27, 12, HOTD, .DLB1

       DropListBox  150, 75, 29, 13, HOTD, .DLB2

       DropComboBox  73, 97, 104, 14, "", .DCB2

       OptionGroup .OG1

          OptionButton  11, 71, 50, 8, "Option", .OB1

          OptionButton  11, 71, 50, 8, "Option", .OB2

          OptionButton  11, 96, 52, 8, "Option", .OB3

    End Dialog

It's always better to ask stupid questions; stupid questions have been known to reduce the frequency of stupid mistakes. :eek:)
 



Hi,

I am not really sure how Extra DropDown control works, but I'd guess that it is returning the numeric position of the selection in a list. So use the list to find the associated string.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I'm sorry, I don't follow. Where would the list find the String? HOTD is a string, with several strings within it. I've tried using an array but got the same result.


Code:
[red][b]
HOTD(0)=" "
HOTD(1)="08:00"
HOTD(2)="09:00"
HOTD(3)="10:00"
HOTD(4)="11:00"
HOTD(5)="12:00"
HOTD(6)="13:00"
HOTD(7)="14:00"
HOTD(8)="15:00"
HOTD(9)="16:00"
HOTD(10)="17:00"[/b][/red]

       '.....
       Text  132, 74, 15, 9, "and"

       Text  72, 72, 26, 8, "between"

       DropListBox  102, 73, 27, 12, [red][b]HOTD()[/b][/red], .DLB1

       DropListBox  150, 75, 29, 13, [red][b]HOTD()[/b][/red], .DLB2

       DropComboBox  73, 97, 104, 14, "", .DCB2
       '.....

[blue]..time will tell![/blue]

It's always better to ask stupid questions; stupid questions have been known to reduce the frequency of stupid mistakes. :eek:)
 
question. why not use dropcombobox instead of droplist?

otherwise you can use a select case

eg:

case is = "0" : t = 00:00
case is = "1" : t = 08:30

or something like that

 
dropcombobox did the trick. Thank you Zak! What's the difference between the two?

It's always better to ask stupid questions; stupid questions have been known to reduce the frequency of stupid mistakes. :eek:)
 
ted,

i wish i knew the difference between droplist vs dropcombo

glad it works now

zak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top