當前位置:編程學習大全網 - 編程軟體 - vb2010編程問題

vb2010編程問題

Public?Class?Form1

Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click

Dim?tStrings(100)?As?String

Dim?i,?j?As?Integer

For?i?=?0?To?ListBox1.Items.Count?-?1

tStrings(i)?=?ListBox1.Items(i)

Next

'冒泡排序

For?i?=?0?To?ListBox1.Items.Count?-?1

For?j?=?0?To?ListBox1.Items.Count?-?i?-?2

If?tStrings(j)?>?tStrings(j?+?1)?Then

Dim?tmp?As?String

tmp?=?tStrings(j)

tStrings(j)?=?tStrings(j?+?1)

tStrings(j?+?1)?=?tmp

End?If

Next

Next

For?i?=?0?To?ListBox1.Items.Count?-?1

ListBox2.Items.Add(tStrings(i))

Next

End?Sub

Private?Sub?Form1_Load(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?MyBase.Load

ListBox1.Items.Add("China")

ListBox1.Items.Add("America")

ListBox1.Items.Add("Japan")

ListBox1.Items.Add("Soccer")

ListBox1.Items.Add("Tennis")

ListBox1.Items.Add("Basketball")

End?Sub

End?Class

運行結果:

  • 上一篇:樹莓派上 bluez 怎麽支持串口 BLE 設備
  • 下一篇:走廊過道適合怎樣的燈光控制?誰了解
  • copyright 2024編程學習大全網