=
ftp1.Passw=
messagebox.show("1")
Dim r As Row = Tables("学生信息").Current
messagebox.show("2")
If ValidPIN(r("身份证件号"))= True
Dim dlg As New OpenFileDialog
dlg.Filter= "图像文件|*.bmp;*.jpg;*.png;*.gif"
If dlg.ShowDialog = DialogResult.OK Then
Dim ifo As new FileInfo(dlg.filename)
Dim img As image = getimage(dlg.filename)
Dim bmp As new bitmap(img.width, img.height)
Dim g = graphics.fromimage(bmp)
g.DrawImage(img, 0, 0, img.Width, img.Height)
Dim jpgEncoder As ImageCodecInfo
Dim codecs() As ImageCodecInfo = ImageCodecInfo.GetImageDecoders
For Each codec As ImageCodecInfo In codecs
If (codec.FormatID = ImageFormat.Jpeg.Guid) Then
jpgEncoder = codec
Exit For
End If
Next
Dim myEncoder As System.Drawing.Imaging.Encoder = System.Drawing.Imaging.Encoder.Quality
Dim myEncoderParameters As EncoderParameters = New EncoderParameters(1)
Dim myEncoderParameter As EncoderParameter = New EncoderParameter(myEncoder, 10) ' 质量级别 0 对应于最大压缩,而质量级别 100 对应于最小压缩
myEncoderParameters.Param(0) = myEncoderParameter
messagebox.show("3")
Dim slt As String = ifo.path & r("身份证件号") & ifo.Extension
bmp.Save(slt,jpgEncoder, myEncoderParameters)
bmp.dispose
g.dispose
messagebox.show("4")
'Dim file As String = "d:\test.jpg"
Dim img1 As image = getImage(slt)
Dim bmp1 As bitmap
If img1.width > 200 Then
If 200 * (img1.height / img1.width) > 150 Then
bmp1 = new bitmap(img1, 200*(150/(200*(img1.height/img1.width))), 150)
Else
bmp1 = new bitmap(img1, 150, 150 * (img1.height / img1.width))
End If
End If
messagebox.show("5")
bmp1.save(slt)
bmp1.Dispose
messagebox.show("6")
If ftp1.Upload(slt,"\xp\" & FileSys.GetName(r("身份证件号") & Ifo.extension),True) = True Then
' Messagebox.show("文件上传完成,请正确填写资料信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
r("相片")="\xp\" & FileSys.GetName(r("身份证件号") & Ifo.extension)
r.save
Else
Messagebox.show("上传失败,请重新上传该文件!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End If
messagebox.show("7")
Else
MessageBox.show("请注意,该学生的身份证件号不正确或不存在,请确定身份证件号后重新上传相片")
End If
在5后6前出现
.NET Framework 版本:2.0.50727.8000
Foxtable 版本:2018.3.3.1
错误所在事件:窗口,学生信息x,Button10,Click
详细错误信息:
未将对象引用设置到对象的实例。
之前好像没这个问题,是什么原因?