以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  路径不能为空  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=128421)

--  作者:susu312
--  发布时间:2018/12/5 19:40:00
--  路径不能为空


此主题相关图片如下:2.png
按此在新窗口浏览图片

 

我没有path这个参数,也不知路径在说啥?

 

\'\'获得各个控件的值
Dim name      As String = e.Form.Controls("name").Value
Dim cardID    As String = e.Form.Controls("cardID").Value
Dim age       As Integer = e.Form.Controls("age").Value
Dim sex       As String = e.Form.Controls("sex").Value
Dim tel       As String = e.Form.Controls("tel").Value
Dim jiguan    As String = e.Form.Controls("jiguan").Value
Dim health    As String = e.Form.Controls("health").Value
Dim rational  As String = e.Form.Controls("rational").Value
Dim partyStanding   As Integer = e.Form.Controls("partyStanding").Value
Dim politicalStatus As String = e.Form.Controls("politicalStatus").Value
Dim leaOrRetire     As String = e.Form.Controls("leaOrRetire").Value
Dim presonalClass   As String = e.Form.Controls("presonalClass").Value
Dim edu             As String = e.Form.Controls("edu").Value
Dim hobbies         As String = e.Form.Controls("hobbies").Value
Dim organName       As String = e.Form.Controls("organName").Value
Dim guanZhu         As String = e.Form.Controls("guanZhu").Value

Dim retiredPost     As String = e.Form.Controls("retiredPost").Value
Dim title           As String = e.Form.Controls("title").Value
Dim address         As String = e.Form.Controls("address").Value
Dim proTecPost      As String = e.Form.Controls("proTecPost").Value
Dim proSpecialty    As String = e.Form.Controls("proSpecialty").Value
Dim partyBranch     As String = e.Form.Controls("partyBranch").Value
Dim retiredDep      As String = e.Form.Controls("retiredDep").Value
Dim jianli          As String = e.Form.Controls("jianli").Value
Dim partyTime       As Date = e.Form.Controls("partyTime").Value
Dim retireTime      As Date = e.Form.Controls("retireTime").Value
Dim workdate        As Date   = e.Form.Controls("workdate").Value
Dim birth           As Date = e.Form.Controls("birth").Value


\'判断值是否为空,若为空,则没必要往下走
\'姓名
If name = ""  Then
    e.Form.Controls("name").Error="姓名不允许为空"
    Return
Else
    name = name.Replace(" ","")
End If

\'\'身份证号
If cardID = ""  Then
    e.Form.Controls("cardID").Error="身份证号不允许为空"
    Return
Else
    cardID =  cardID.Replace(" ","")
End If

\'\'年龄
\'If age = ""  Then
    \'e.Form.Controls("age").Error="年龄不允许为空"
    \'Return
\'\'Else
    \'\'age = age.Replace(" ","")
\'End If

\'出生日期
If e.Form.Controls("birth").Value Is Nothing  Then
    e.Form.Controls("birth").Error="出生年月不允许为空"
    Return
Else
    birth = e.Form.Controls("birth").Value
End If

\'\'性别
If sex = ""  Then
    e.Form.Controls("sex").Error="单位不允许为空"
    Return
Else
    sex = sex.Replace(" ","")
End If


\'\'联系方式
If tel = ""  Then
    e.Form.Controls("tel").Error="联系电话不允许为空"
    Return
Else
    tel = tel.Replace(" ","")
End If

\'\'籍贯
If jiguan = ""  Then
    e.Form.Controls("jiguan").Error="籍贯不允许为空"
    Return
Else
    jiguan =  jiguan.Replace(" ","")
End If

\'\'健康状况
If health = ""  Then
    e.Form.Controls("health").Error="健康状况不允许为空"
    Return
Else
    health = health.Replace(" ","")
End If

\'民族
If ratirational").Error="民族不允许为空"
    Return
Else
    rational = rational.Replace(" ","")
End If

\'\'入党时间
If e.Form.Controls("partyTime").Value Is Nothing Then
      partyTime = Nothing
End If

\'\'政治面貌
If politicalStatus = ""  Then
    e.Form.Controls("politicalStatus").Error="政治面貌不允许为空"
    Return
Else
    politicalStatus = politicalStatus.Replace(" ","")
End If

\'\'离退休状态
If leaOrRetire = ""  Then
    e.Form.Controls("leaOrRetire").Error="离退休状态不允许为空"
    Return
Else
    leaOrRetire = leaOrRetire.Replace(" ","")
End If

\'\'学历
If edu = ""  Then
    e.Form.Controls("edu").Error="学历不允许为空"
    Return
Else
    edu = edu.Replace(" ","")
End If

\'\'单位
If organName = ""  Then
    e.Form.Controls("organName").Error="单位不允许为空"
    Return
Else
    organName = organName.Replace(" ","")
End If

\'\'部门
If retiredDep = ""  Then
    e.Form.Controls("retiredDep").Error="部门不允许为空"
    Return
Else
    retiredDep = retiredDep.Replace(" ","")
End If

\'\'职务
If retiredPost = ""  Then
    e.Form.Controls("retiredPost").Error="离退休职务不允许为空"
    Return
Else
    retiredPost = retiredPost.Replace(" ","")
End If

\'离退休时间
If e.Form.Controls("retireTime").Value Is Nothing Then
    e.Form.Controls("retireTime").Error="离退休时间不允许为空"
    Return
Else
    retireTime = e.Form.Controls("retireTime").Value
End If

\'\'专业技术职务
If proTecPost = ""  Then
    e.Form.Controls("proTecPost").Error="专业技术职务不允许为空"
    Return
Else
    proTecPost = proTecPost.Replace(" ","")
End If

\'参加工作日期
If e.Form.Controls("workdate").Value Is Nothing Then
   e.Form.Controls("workdate").Error="参加工作时间不允许为空"
   Return
Else
   workdate = e.Form.Controls("workdate").Value
End If

\'\'地址
If address = ""  Then
    e.Form.Controls("address").Error="地址不允许为空"
    Return
Else
    address = address.Replace(" ","")
End If

\'\'处理照片
\'Dim ImageString As String
Dim ImageByte() As Byte
If e.Form.Controls("PictureBox1").ImageFile Is Nothing Then
     \'Messagebox.show("照片为空","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
\'Else
   Dim fl As String = e.Form.Controls("PictureBox1").ImageFile
   Dim fs As New IO.FileStream(fl, IO.FileMode.Open , IO.FileAccess.Read)   \'用文件流打开图片
   Dim br As New IO.BinaryReader(fs)   \'根据文件流,申明一个二进制阅读器
   \'Dim ImageByte() As Byte = br.ReadBytes(fs.Length)   \'阅读器读取文件流,并将独到的二进制放入数组ImageByte中,
   ImageByte = br.ReadBytes(fs.Length)   \'阅读器读取文件流,并将独到的二进制放入数组ImageByte中,
   \'ImageString  = BitConverter.ToString(imageByte).Replace("-", "")  \' SQLCommand 不能直接Insert 二进制,只能拼接SQL语句,所以这里把二进制变成字符
End If
\'
\'打开家庭信息页面
Messagebox.show("基本信息已填写完成,请填写附加信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Dim tab As WinForm.TabControl = e.Form.Controls("TabControl1")
tab.SelectedIndex = 1

 

 

这是代码


--  作者:有点甜
--  发布时间:2018/12/5 20:57:00
--  

1、msgbox(e.Form.Controls("PictureBox1").ImageFile) 看看,看是不是空值。

 

2、加入msgbox定位出错位置 http://www.foxtable.com/webhelp/scr/1485.htm