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

Sorting Combobox 1

Status
Not open for further replies.

GrantWeb

Programmer
Jan 13, 2012
1
0
0
ZA
Hi everyone,

I need to sort the content of a combobox alphbetically but the problem is that string starts with a numeric value, example -

10002489 Tempo
10001075 Cosmos
10001158 Lining

Hope someone can please help,
Thank you.
 
Hi

Instead of comparing the whole strings compare only their relevant parts.

If all numeric prefixes are 8 character long as in the example, [tt]Copy[teal]([/teal]str[teal],[/teal][purple]10[/purple][teal],[/teal]Length[teal]([/teal]str[teal]))[/teal][/tt] is enough. Otherwise just take the part after the first space : [tt]Copy[teal]([/teal]str[teal],[/teal]Pos[teal]([/teal][green]' '[/green][teal],[/teal]str[teal])+[/teal][purple]1[/purple][teal],[/teal]Length[teal]([/teal]str[teal]))[/teal][/tt] .

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top