Foxtable(狐表)用户栏目专家坐堂 → [求助]请教:要实现以下结果,代码该怎么样优化?【已结】


  共有2494人关注过本帖树形打印复制链接

主题:[求助]请教:要实现以下结果,代码该怎么样优化?【已结】

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/5/10 10:40:00 [显示全部帖子]

 请上传实例

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/5/10 11:17:00 [显示全部帖子]

Dim qujian1 As WinForm.TextBox = e.Form.Controls("TextBox1")
If qujian1.Value Is Nothing Then
    MessageBox.Show("请至少设置一个区间!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
Else
    Dim idx As Integer
    For i As Integer = 4 To 1 Step -1
        Dim txt As WinForm.TextBox = e.Form.controls("Textbox" & i)
        If txt.text > "" Then
            idx = i
            Exit For
        End If
    Next

    For Each dr As DataRow In DataTables("表B").Select("")
        For i As Integer = idx To 1 Step -1
            Dim txt As WinForm.TextBox = e.Form.controls("Textbox" & i)
            If txt.text > "" Then
                If i = idx Then
                    If dr("分数") >= val(txt.Text) Then
                        dr("等级") = txt.text & "分以上"
                        Exit For
                    End If
                Else
                    If dr("分数") >= val(txt.Text) Then
                        dr("等级") = txt.text & " - " & e.form.controls("Textbox" & i+1).Text & "分"
                        Exit For
                    ElseIf i = 1 Then
                        If dr("分数") <= val(txt.Text) Then
                            dr("等级") = txt.text & "分以下"
                            Exit For
                        End If
                    End If
                End If
            End If
        Next
    Next
End If


 回到顶部