以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  代码问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=126873)

--  作者:cd_tdh
--  发布时间:2018/10/30 16:35:00
--  代码问题

老师,这是写在DataColChanged事件的一段代码,为什么代码重排后End  Select与Select不能对齐呢?

\'勾选到业绩管理
If e.DataCol.Name  = "审批状态"
    If e.DataRow("审批状态") = "已审批完成" Then
        Dim nma() As String = { "合同编码","项目编码","合同编码","所属机构","项目类别","项目名称","合同金额","合同工期","开工日期","竣工日期","项目经理","项目总工" }     \'合同签订数据来源列
        Dim nmb() As String = { "合同编码","项目编码","合同编码","所属机构名称","项目类别","项目名称","合同金额","合同工期","开工日期","竣工日期","项目经理","项目总工" }   \'业绩管理数据接收列
        e.DataRow.save
        Dim da As DataRow = DataTables("业绩管理") .AddNew
        For i As Integer = 0 To nma.Length - 1
            da(nmb(i)) = e.DataRow(nma(i))
        Next
        DataTables("业绩管理") .save
    Else
        DataTables("业绩管理") .SQLdeletefor("合同编码 = \'" & e.DataRow("合同编码") & "\'")
        DataTables("业绩管理") .save
    End If
End If
\'跨表自动更新-业绩管理
Select  Case e.DataCol.Name
    Case  "项目编码","合同编码","所属机构","项目类别","项目名称","合同金额","合同工期","开工日期","竣工日期","项目经理","项目总工"
        Dim Filter  As  String = "合同编码 = \'" & e.DataRow("合同编码") & "\'"
        Dim drs  As  List(Of DataRow) =  DataTables("业绩管理").Select(Filter)
        For  Each drr  As  DataRow  In drs
            drr(e.DataCol.Name) = e.NewValue
        Next
    End  Select
    \'勾选到合同归档
    If e.DataCol.Name  = "审批状态"
        If e.DataRow("审批状态") = "已审批完成" Then
            Dim nma() As String = { "合同编码","项目编码","合同编码","所属机构","项目类别","招标方式","项目名称","建设单位","合同金额","合同工期","项目经理","项目总工" }     \'合同签订数据来源列
            Dim nmb() As String = { "合同编码","项目编码","合同编码","所属机构","项目类别","招标方式","项目名称","建设单位","合同金额","合同工期","项目经理","项目总工" }   \'业绩管理数据接收列
            e.DataRow.save
            Dim dw As DataRow = DataTables("合同归档") .AddNew
            For i As Integer = 0 To nma.Length - 1
                dw(nmb(i)) = e.DataRow(nma(i))
            Next
        DataTables("业绩管理") .save
        Else
            DataTables("合同归档").SQLdeletefor("合同编码 = \'" & e.DataRow("合同编码") & "\'")
            DataTables("合同归档").Save
        End If
    End If
    \'跨表自动更新-合同归档
    Select  Case e.DataCol.Name
        Case  "项目编码","合同编码","所属机构","项目类别","招标方式","项目名称","建设单位","合同金额","合同工期","项目经理","项目总工"
            Dim Filter  As  String = "合同编码 = \'" & e.DataRow("合同编码") & "\'"
            Dim db  As  List(Of DataRow) =  DataTables("合同归档").Select(Filter)
            For  Each dd  As  DataRow  In db
                dd(e.DataCol.Name) = e.NewValue
            Next
        End  Select


--  作者:有点甜
--  发布时间:2018/10/30 16:40:00
--  

不要有多余空格即可,如

 

Select Case e.DataCol.Name
    Case  "项目编码","合同编码","所属机构","项目类别","招标方式","项目名称","建设单位","合同金额","合同工期","项目经理","项目总工"
        Dim Filter  As  String = "合同编码 = \'" & e.DataRow("合同编码") & "\'"
        Dim db  As  List(Of DataRow) =  DataTables("合同归档").Select(Filter)
        For  Each dd  As  DataRow  In db
            dd(e.DataCol.Name) = e.NewValue
        Next
End Select