Foxtable(狐表)用户栏目专家坐堂 → [求助]代码太长,看能不能简化?


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

主题:[求助]代码太长,看能不能简化?

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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/8/3 10:20:00 [显示全部帖子]

If e.form.Controls("ComboBox1").Value Is Nothing Then
    MsgBox("请选择患者住院号!",64,"提示")
    Return
End If
Dim r As Row = CurrentTable.AddNew
If e.Form.Controls("DateTimePicker1").Value Is Nothing And e.Form.Controls("ComboBox5").Value IsNot Nothing Then
    r("住院号") =e.Form.Controls("ComboBox1").value.split(":")(2)
    r("开嘱日期") =Date.Today
    r("医生") =e.Form.Controls("ComboBox5").value.split(":")(1)
End If
If e.Form.Controls("DateTimePicker1").Value Is Nothing And e.Form.Controls("ComboBox5").Value Is Nothing Then
    r("住院号") =e.Form.Controls("ComboBox1").value.split(":")(2)
    r("开嘱日期") =Date.Today
End If
If e.Form.Controls("DateTimePicker1").Value IsNot Nothing And e.Form.Controls("ComboBox5").Value Is Nothing Then
    r("住院号") =e.Form.Controls("ComboBox1").value.split(":")(2)
    r("开嘱日期") =e.Form.Controls("DateTimePicker1").value
End If
If e.Form.Controls("DateTimePicker1").Value IsNot Nothing And e.Form.Controls("ComboBox5").Value IsNot Nothing Then
    r("住院号") =e.Form.Controls("ComboBox1").value.split(":")(2)
    r("开嘱日期") =e.Form.Controls("DateTimePicker1").value
    r("医生") =e.Form.Controls("ComboBox5").value.split(":")(1)
End If 

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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/8/3 10:36:00 [显示全部帖子]

If e.form.Controls("ComboBox1").Value Is Nothing Then
    MsgBox("请选择患者住院号!",64,"提示")
    Return
End If
Dim r As Row = CurrentTable.AddNew
r("住院号") =e.Form.Controls("ComboBox1").value.split(":")(2)
If e.Form.Controls("DateTimePicker1").Value Is Nothing Then
    r("开嘱日期") =Date.Today
Else
    r("开嘱日期") =e.Form.Controls("DateTimePicker1").value
End If
If  e.Form.Controls("ComboBox5").Value IsNot Nothing Then
    r("医生") =e.Form.Controls("ComboBox5").value.split(":")(1)
End If

 回到顶部