| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 450 人关注过本帖
标题:[求助]新手问问题
取消只看楼主 加入收藏
yuan1983
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-4-29
收藏
 问题点数:0 回复次数:3 
[求助]新手问问题

如何实现下面的数组排序 老显示编译错误
Function ArraySum(arr As Variant) As Variant

Dim intCount As Long
Dim ArrayDemo As String
Dim intMark As Long
Dim atemp() As Integer
Dim colTemp As Collection
Dim strField As Integer
Dim strLine As Integer
Dim Lstr As String
Dim FileNumber
Dim f() As Integer


If ExistFile(NormalizePath(Trim$(colTemp(Key_DBPath))) & "BKPF.TXT") = True Then
intCount = ReturnTxtCount(NormalizePath(Trim$(colTemp(Key_DBPath))) & "BKPF.TXT")

Dim colFields As Collection
GetFields "BKPF", colFields


FileNumber = FreeFile ' 取得未使用的档案代码。
Open NormalizePath(Trim$(colTemp(Key_DBPath))) & "BKPF.TXT" For Input As #FileNumber
Dim bGetField As Boolean
bGetField = False

Do While Not EOF(FileNumber)
intMark = intMark + 1
Line Input #FileNumber, Lstr
If InStr(1, Lstr, "|") > 0 Then

If bGetField = False Then
bGetField = True

Else
'将所有科目均拷入临时表中
atemp = Split(Lstr, "|")

'Code
strField = "K" & DelTabAndCrlf(atemp(colFields("FieldKUNNR")))
strLine = "'" & strField & "'"
strLine = strLine & ","
End If
End If
Loop
Close #FileNumber
End If
ArraySum = f()
End Function
上面这一段是查找数组记录下数组的值
下面一段是进行排序
Sub BubbleSort(list() As Double)
' 冒泡法进行排序

Dim First As Double, Last As Double
Dim I As Integer, j As Integer
Dim Temp As Double

I = f()
j = f()

First = LBound(list)
Last = UBound(list)
For I = First To Last - 1
For j = I + 1 To Last
If list(I) > list(j) Then
Temp = list(j)
list(j) = list(I)
list(I) = Temp
End If
Next j
Next I
End Sub

搜索更多相关主题的帖子: 如何 
2007-04-29 15:59
yuan1983
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-4-29
收藏
得分:0 
回复:(Kendy123456)哪里报错 把报错的行变色
I = f() 这一行
不是返回的类型不对呀
2007-04-29 16:03
yuan1983
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-4-29
收藏
得分:0 
回复:(Kendy123456)哪里报错 把报错的行变色

帮忙看一下究竟是那点出问题了 谢谢

2007-04-29 16:06
yuan1983
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-4-29
收藏
得分:0 
那如何才能把查到的数组返回出来呢
2007-04-29 16:48
快速回复:[求助]新手问问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017204 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved