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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel sheet data is Boolean (=True), comes into ListBox as 0, -1

Status
Not open for further replies.

WantsToLearn

Programmer
Feb 15, 2003
147
US
How can I force the ListBox to display the data as True, False instead of 0, -1 on a UserForm?

Thanks for any ideas and/or suggestions!
 
Hi WantsToLearn,

What is the source of your data?

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Hello Tony,

The source of my data is an Excel named range. If I enter True it converts it to TRUE which I is equivalent to =TRUE. I can get it to text by entering 'True but since I didn't think of that earlier I would like to finish learning what I started.

I am creating an array via ADO GetRows and that is the source for my listbox.

Thanks for the help and congratulations on being TipMaster of the week recently!
 
Hi WantsToLearn,

I know I asked, but I don't think the set up is relevant (I have tried it but get the same problem with hard coded values); what happens seems to be something to do with the nature of the listbox, not the data source.

Listboxes are, essentially, text-only and I don't think there's any way to control the formatting of individual elements so your options would seem to be limited to changing your data source (as you have done) or translating the boolean values to text in your array before setting the source of the listbox, something like this pseudo-pseudocode ..

For each element in GotRows
element = iif(element=True,"True","False")
Next

Thanks for the congratulations but, TipMaster or no, I'm afraid that's the best I can do [smile]

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Thanks, Tony. I just converted it and everything is working OK. I just wanted to make sure I wasn't missing something obvious.

Have a great day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top