如何排序列表框不是由第一个字母? [英] How to sort a listBox not by the first letter?

查看:70
本文介绍了如何排序列表框不是由第一个字母?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法按姓氏排序客户联系人列表。每当我按下按姓氏排序按钮时,它总是按照客户的名字按字母顺序排列

,因为我把它们放在姓氏之前,它是每行的第一个字符串在listBox中。

我在sortBySurname下的代码是

Hi, I am having trouble sorting a client contact lists by their surname. Every time when I press the "sort by surname button, it always appear alphabetical order
by clients'' first name, because I put them before the surname, it is the first String of the every line in the listBox.
My code under the sortBySurname is

展开 | 选择 | Wrap | 行号

推荐答案

显然姓氏应该在给定的姓名和姓名缩写之前。

在这种情况下,你说你的排序会按预期运作。

如果做错了,请将其编码为排序第二大写字母
Clearly the surname should come before the given names and initials.
In which case as you say your sort would work as intended.
Failing that, code it to sort on the second capital letter


没有函数可以自动在字符串数组的字符串中查找第二个单词,并对该单词上的数组进行排序。您必须手动排序或使用前面的最后一个单词重新排序您的字符串(即姓氏优先)。


这是一个.NET问题,我正在将其移至那个论坛。
There is no function that automatically finds the second word in a string of an array of strings and sorts the array on that word. You will have to sort by hand or re-order your string with the last word at the front (i.e. surname first).

This is a .NET problem and I am moving it to that forum.


@Banfa


非常感谢!!它解决了我一个大问题。但是,如果我需要按每行中的位置排序呢?该位置是一个名为locationComboBox的组合框。我应该在哪里放置语法和我应该放什么代码?


非常感谢
@Banfa
Thanks very much!! It solves me a big question. But what if I need to sort by the location in each line? the location is a Combo box called locationComboBox. Where should I put the syntax and what code should I put?

Many thanks


这篇关于如何排序列表框不是由第一个字母?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆