真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb點虐 數(shù)組降序 求降序數(shù)vb

vb點虐 datagridview控件 如何點擊列頭進行排序的時候 第一次點擊為降序 求助各路大神

DataGridView.Sort(this.dataGridViewTextBoxColumn1, ListSortDirection.Descending);降序

織金ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18980820575(備注:SSL證書合作)期待與您的合作!

DataGridView.Sort(this.dataGridViewTextBoxColumn1, ListSortDirection.Ascending);升序

dataGridViewTextBoxColumn1是列名

VB對二維數(shù)組排序

寫了一個簡單的例子,你可以參考一下,希望對你有幫助。

Private Sub Form_Load()

Dim A(5, 5) As Integer

Dim I, J, K As Integer

Dim Temp As Integer

Show

'生成二維數(shù)組

Randomize

For I = 0 To 5

For J = 0 To 5

A(I, J) = Int(Rnd * 90 + 10)

Print A(I, J);

Next J

Print

Next I

Print "======================="

'排序二維數(shù)組

'一維排序

For I = 0 To 5

For J = 0 To 4

For K = J + 1 To 5

If A(I, J) = A(I, K) Then

Temp = A(I, J)

A(I, J) = A(I, K)

A(I, K) = Temp

End If

Next K

Next J

Next I

'二維排序

For I = 0 To 5

For J = 0 To 4

For K = J + 1 To 5

If A(J, I) = A(K, I) Then

Temp = A(J, I)

A(J, I) = A(K, I)

A(K, I) = Temp

End If

Next K

Next J

Next I

'重新打印二維數(shù)組

For I = 0 To 5

For J = 0 To 5

Print A(I, J);

Next J

Print

Next I

End Sub

VB.NET數(shù)組的排序法?

如果你是從vb6剛過渡上vb。net,建議還是用冒泡排序法,容易理解。

如果你正努力學習vb。net的方法,推薦一個例子如下:

Imports System

Imports System.Collections

Public Class SamplesArray

Public Class myReverserClass

Implements IComparer

' Calls CaseInsensitiveComparer.Compare with the parameters reversed.

Function Compare(x As Object, y As Object) As Integer _

Implements IComparer.Compare

Return New CaseInsensitiveComparer().Compare(y, x)

End Function 'IComparer.Compare

End Class 'myReverserClass

Public Shared Sub Main()

' Creates and initializes a new Array and a new custom comparer.

Dim myArr As [String]() = {"The", "QUICK", "BROWN", "FOX", "jumps", "over", "the", "lazy", "dog"}

Dim myComparer = New myReverserClass()

' Displays the values of the Array.

Console.WriteLine("The Array initially contains the following values:")

PrintIndexAndValues(myArr)

' Sorts a section of the Array using the default comparer.

Array.Sort(myArr, 1, 3)

Console.WriteLine("After sorting a section of the Array using the default comparer:")

PrintIndexAndValues(myArr)

' Sorts a section of the Array using the reverse case-insensitive comparer.

Array.Sort(myArr, 1, 3, myComparer)

Console.WriteLine("After sorting a section of the Array using the reverse case-insensitive comparer:")

PrintIndexAndValues(myArr)

' Sorts the entire Array using the default comparer.

Array.Sort(myArr)

Console.WriteLine("After sorting the entire Array using the default comparer:")

PrintIndexAndValues(myArr)

' Sorts the entire Array using the reverse case-insensitive comparer.

Array.Sort(myArr, myComparer)

Console.WriteLine("After sorting the entire Array using the reverse case-insensitive comparer:")

PrintIndexAndValues(myArr)

End Sub 'Main

Public Shared Sub PrintIndexAndValues(myArr() As [String])

Dim i As Integer

For i = 0 To myArr.Length - 1

Console.WriteLine(" [{0}] : {1}", i, myArr(i))

Next i

Console.WriteLine()

End Sub 'PrintIndexAndValues

End Class 'SamplesArray

'This code produces the following output.

'

'The Array initially contains the following values:

' [0] : The

' [1] : QUICK

' [2] : BROWN

' [3] : FOX

' [4] : jumps

' [5] : over

' [6] : the

' [7] : lazy

' [8] : dog

'

'After sorting a section of the Array using the default comparer:

' [0] : The

' [1] : BROWN

' [2] : FOX

' [3] : QUICK

' [4] : jumps

' [5] : over

' [6] : the

' [7] : lazy

' [8] : dog

'

'After sorting a section of the Array using the reverse case-insensitive comparer:

' [0] : The

' [1] : QUICK

' [2] : FOX

' [3] : BROWN

' [4] : jumps

' [5] : over

' [6] : the

' [7] : lazy

' [8] : dog

'

'After sorting the entire Array using the default comparer:

' [0] : BROWN

' [1] : dog

' [2] : FOX

' [3] : jumps

' [4] : lazy

' [5] : over

' [6] : QUICK

' [7] : the

' [8] : The

'

'After sorting the entire Array using the reverse case-insensitive comparer:

' [0] : the

' [1] : The

' [2] : QUICK

' [3] : over

' [4] : lazy

' [5] : jumps

' [6] : FOX

' [7] : dog

' [8] : BROWN

VB中輸入10個數(shù)并按要求進行升序排序和降序的程序

Dim?AA(1?To?10)?As?Integer,?ZGCJ(1?To?10)?As?Integer,?ZDCJ(1?To?10)?As?Integer

在通用部分聲明三個數(shù)組

Private?Sub?Command1_Click()

Text1.Text?=?"":?Text2.Text?=?"":?Text3.Text?=?""

Text1.Text?=?"系統(tǒng)自動生成的十個數(shù):"??vbCrLf

For?I?=?1?To?10

AA(I)?=?0:?ZGCJ(I)?=?0:?ZDCJ(I)?=?0

Randomize

AA(I)?=?Int(Rnd?*?90?+?10)

Text1.Text?=?Text1.Text??AA(I)??Space(4)

If?I?Mod?5?=?0?Then?Text1.Text?=?Text1.Text??vbCrLf

ZGCJ(I)?=?AA(I)

ZDCJ(I)?=?AA(I)

Next?I

End?Sub

生成十個數(shù)的代碼

Private?Sub?Command2_Click()

Text2.Text?=?"":?Text3.Text?=?""

Dim?AAA?As?Integer,?BBB?As?Integer

For?I?=?1?To?9

For?J?=?I?+?1?To?10

If?ZGCJ(I)??ZGCJ(J)?Then

AAA?=?ZGCJ(I)

ZGCJ(I)?=?ZGCJ(J)

ZGCJ(J)?=?AAA

End?If

If?ZDCJ(J)??ZDCJ(I)?Then

BBB?=?ZDCJ(J)

ZDCJ(J)?=?ZDCJ(I)

ZDCJ(I)?=?BBB

End?If

Next?J

Next?I

Text2.Text?=?Text2.Text??"從大到小排列:"??vbCrLf

For?I?=?1?To?10

Text2.Text?=?Text2.Text??ZGCJ(I)??Space(4)

If?I?Mod?5?=?0?Then?Text2.Text?=?Text2.Text??vbCrLf

Next?I

Text3.Text?=?Text3.Text??"從小到大排列:"??vbCrLf

For?I?=?1?To?10

Text3.Text?=?Text3.Text??ZDCJ(I)??Space(4)

If?I?Mod?5?=?0?Then?Text3.Text?=?Text3.Text??vbCrLf

Next?I

End?Sub

排序的代碼。

如果需要自己輸入數(shù)字,可以這樣:

'如果要自己輸入數(shù)字,可以修改下面的代碼

Text1.Text?=?"":?Text2.Text?=?"":?Text3.Text?=?""

Text1.Text?=?"系統(tǒng)自動生成的十個數(shù):"??vbCrLf

For?I?=?1?To?10

AA(I)?=?0:?ZGCJ(I)?=?0:?ZDCJ(I)?=?0

Randomize

AA(I)?=?Int(Rnd?*?90?+?10)

Text1.Text?=?Text1.Text??AA(I)??Space(4)

If?I?Mod?5?=?0?Then?Text1.Text?=?Text1.Text??vbCrLf

ZGCJ(I)?=?AA(I)

ZDCJ(I)?=?AA(I)

Next?I

'----------------------------修改為:

Text1.Text?=?"":?Text2.Text?=?"":?Text3.Text?=?""

Text1.Text?=?"用戶輸入的十個數(shù):"??vbCrLf

For?I?=?1?To?10

AA(I)?=?0:?ZGCJ(I)?=?0:?ZDCJ(I)?=?0

AA(I)?=?Val(InputBox("請輸入第"??I??"個數(shù)!"))

Text1.Text?=?Text1.Text??AA(I)??Space(4)

If?I?Mod?5?=?0?Then?Text1.Text?=?Text1.Text??vbCrLf

ZGCJ(I)?=?AA(I)

ZDCJ(I)?=?AA(I)

Next?I


分享題目:vb點虐 數(shù)組降序 求降序數(shù)vb
分享鏈接:http://weahome.cn/article/ddsosoh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部