Foxtable(狐表)用户栏目专家坐堂 → 精简代码select case


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

主题:精简代码select case

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


加好友 发短信
等级:四尾狐 帖子:808 积分:6213 威望:0 精华:0 注册:2014/3/23 23:02:00
精简代码select case  发帖心情 Post By:2015/8/29 15:13:00 [显示全部帖子]

求教,可否精简以下代码:
Select Case e.DataCol.Name
    Case "左座"
        Dim dr As DataRow = e.DataRow
        Dim h As String = dr("左座")
        Dim h2 As String = dr("飞行员")
        Dim h3 As String = dr("右座")
        Dim nms() As String = h2.Split(",")
        If nms.Length = 2 Then
            dr("右座") = h2.replace(h, "").replace(",", "")
        End If
    Case "右座"
        Dim dr As DataRow = e.DataRow
        Dim h As String = dr("左座")
        Dim h2 As String = dr("飞行员")
        Dim h3 As String = dr("右座")
        Dim nms() As String = h2.Split(",")        
        If nms.Length > 2 Then
            dr("观察员1") = h2.replace(h3 , "").replace(h, "").replace(",", "")
        End If
End Select


 回到顶部