ListBoxオブジェクトを使用してC#でWindowsアプリケーションを作成するとします。私は購入するために6種類のものがある注文書を作成する必要があります。誰かが私にリストボックスをコード化する方法を教えてもらえますか?C#ListBoxアプリケーションの作成
1
A
答えて
0
ListBox classをご覧ください。このMSDNページには多くの例があります。項目のリストを保持するItemsプロパティを見てください。
1
はおそらく、あなたはこのように、リストボックスを使用することができます"c# listbox tutorial"
1
のためのgoogle:
private void button1_Click(object sender, System.EventArgs e)
{
// Create an instance of the ListBox.
ListBox listBox1 = new ListBox();
// Set the size and location of the ListBox.
listBox1.Size = new System.Drawing.Size(200, 100);
listBox1.Location = new System.Drawing.Point(10,10);
// Add the ListBox to the form.
this.Controls.Add(listBox1);
// Set the ListBox to display items in multiple columns.
listBox1.MultiColumn = true;
// Set the selection mode to multiple and extended.
listBox1.SelectionMode = SelectionMode.MultiExtended;
// Shutdown the painting of the ListBox as items are added.
listBox1.BeginUpdate();
// Loop through and add 50 items to the ListBox.
for (int x = 1; x <= 50; x++)
{
listBox1.Items.Add("Item " + x.ToString());
}
// Allow the ListBox to repaint and display the new items.
listBox1.EndUpdate();
// Select three items from the ListBox.
listBox1.SetSelected(1, true);
listBox1.SetSelected(3, true);
listBox1.SetSelected(5, true);
// Display the second selected item in the ListBox to the console.
System.Diagnostics.Debug.WriteLine(listBox1.SelectedItems[1].ToString());
// Display the index of the first selected item in the ListBox.
System.Diagnostics.Debug.WriteLine(listBox1.SelectedIndices[0].ToString());
}
関連する問題
- 1. ListBoxのデータテンプレートをWindowPhone7用に作成
- 2. Sort ListBox C#
- 3. dynamicaly created listbox C#
- 4. c#listbox ASP.Netで
- 5. C#のログファイルを作成するアプリケーション
- 6. C#:Webアプリケーションのタスクスケジューラを作成する
- 7. C#listboxコレクションの構文
- 8. C#アプリケーションでデータベースを作成する
- 9. プリンタページ設定を構成するためのC#アプリケーションの作成
- 10. c#ListBox SQLiteデータベースより
- 11. BindingListとListBoxの動作
- 12. VBA - Strange Combobox/Listboxの動作
- 13. カルーセルの作成時にrole = "listbox"とは何ですか?
- 14. ListBoxアイテムのアイテムテキストと異なる値を作成する
- 15. ListBoxを作成して親コンテナの幅を塗りつぶす
- 16. ListBoxのデザイン時にコントロール配列を作成する方法は?
- 17. C#アプリケーション構成データ
- 18. ListBoxの個別のテキストをC#
- 19. LB_SETITEMDATA ListBoxが動作しませんWin32 Api C++
- 20. WiFiアプリケーションの作成
- 21. C#listBox selectedValueはnullのままです
- 22. カスタムWPFのListBox使ってC#
- 23. コンパイラはCで私の最初のアプリケーションの作成インストールライブラリヘッダに
- 24. C#アプリケーションのシステムアイコンの操作
- 25. ListBoxアイテムをWPFで1つずつ作成
- 26. Visual C++:他のリソースにアプリケーションのアイコンを作成する
- 27. C#アプリケーションを作成するためのCNTKの使用
- 28. 私のC#アプリケーションの内部に「ping」を作成する
- 29. C#自分のアプリケーションの購入システムを作成する
- 30. vb6アプリケーションのC#killイベントを作成しますか?
はこの宿題ですか? –
私のクラスのためのその余分な信用 – user542672
あなたはそれを撮影するのはいかがですか?どこかで立ち往生し、特定の "これがどうやって動かないの?"質問。 –