準備
(なし)
デザイン
1. フォーム (Form1) にボタン (button1) を配置します。
2. フォーム (Form1) にリストボックス (listBox1) を配置します。
サンプルコード (C#)
// 名前空間の追加
using System.Collections;
// コード
private void button1_Click(object sender, EventArgs e)
{
Hashtable ht = new Hashtable();
ht.Add("key4", "!");
ht.Add("key2", ",");
ht.Add("key1", "Hello");
ht.Add("key3", "World");
foreach (object item in ht.Values)
{
listBox1.Items.Add((string)item);
}
listBox1.Items.Add(Environment.NewLine);
SortedList sl = new SortedList(ht);
foreach (object item in sl.Values)
{
listBox1.Items.Add((string)item);
}
}
解説
HashTable を元に SortedList を作成しています。SortedList の内容は自動的にソートされています。
結果

動作確認環境
Visual Studio 2015 Professional (C# 6.0)