图片从Picturebox到另一个Picturebox

时间:2018-02-17 14:29:52

标签: sql vb.net

我创建了一个使用即插即用USB端口条码扫描器监控系统的系统,它将扫描身份证号码。 (当我插入扫描仪时,它只扫描条形码显示代码)。将他们的信息放在每个小组中。如图像Image From Left to Right

所示

如何将第一张图像(左图像)从第一张图片框移动到第二张图片框(中央图像),将第二张图片图像移动到第三张图片框(右图像)。它作为两个图像(从中心到右边)是任何个人的最近记录。

这是我的代码:带有SQL的Adodb

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        TextBoxIDNumberIn.Text = TextBoxIDNumberTrigger.Text
        Try
            Connection()
            sql = "Select * from Info where ID_Number like '" + TextBoxIDNumberTrigger.Text + "'"
            rs.Open(sql, conn)
            If rs.Fields(0).Value = TextBoxIDNumberTrigger.Text Then
                TextBoxIDNumberTrigger.Text = rs.Fields(0).Value
                textboxCategoryTriggers.Text = rs.Fields(1).Value
                TextBoxNameTrigger.Text = rs.Fields(3).Value + " " + rs.Fields(4).Value + ". " + rs.Fields(2).Value
                textboxImageLocation.Text = rs.Fields(12).Value.ToString
                Try
                    Connection1()
                    sql1 = "Select * from allthisTime where idnumber like '" + TextBoxIDNumberTrigger.Text + "' and timeout like '" + "Not Yet" + "' and datesss like '" + Date.Today + "'"
                    rs1.Open(sql1, conn1, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
                    rs1.Update()
                    rs1.Fields(2).Value = TimeOfDay
                    rs1.UpdateBatch()
                    PictureBox1.ImageLocation = textboxImageLocation.Text
                    textboxCategory1.Text = textboxCategoryTriggers.Text
                    textboxIDNumber1.Text = TextBoxIDNumberTrigger.Text
                    textboxName1.Text = TextBoxNameTrigger.Text
                    TextBoxIDNumberTrigger.Text = ""
                    textboxTime1.Text = "Time Out"
                    conn1.Close()
                Catch ex As Exception
                    conn1.Close()
                    Connection1()
                    sql1 = "Select * from allthisTime"
                    rs1.Open(sql1, conn1, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
                    rs1.AddNew()
                    rs1.Fields(0).Value = TextBoxIDNumberTrigger.Text
                    rs1.Fields(1).Value = TimeOfDay
                    rs1.Fields(2).Value = "Not Yet"
                    rs1.Fields(3).Value = Date.Today
                    rs1.Update()

                    PictureBox1.ImageLocation = textboxImageLocation.Text
                    textboxCategory1.Text = textboxCategoryTriggers.Text
                    textboxIDNumber1.Text = TextBoxIDNumberTrigger.Text
                    textboxName1.Text = TextBoxNameTrigger.Text
                    TextBoxIDNumberTrigger.Text = ""
                    textboxTime1.Text = "Time In"
                    conn1.Close()
                End Try
                conn.Close()
            End If
            TimeIn()
        Catch ex1 As Exception
            MsgBox("ID Number doesn't exists. Please contact system administrator.")
            TextBoxIDNumberTrigger.Text = ""
            conn.Close()
        Finally
            TimeIn()
        End Try
        'conn.Close()
        TextBoxIDNumberTrigger.Text = ""
        PictureBox2.Image = PictureBox1.Image
        PictureBox3.Image = PictureBox2.Image

    End Sub

1 个答案:

答案 0 :(得分:0)

据我所知,您需要将PictureBox1图像传递给PictureBox2,将旧PictureBox2传递给PictureBox3。

如果是,那么您只需要使用此代码(如果PictureBox1已经有图像和图像显示没有问题):

PictureBox3.ImageLocation = PictureBox2.ImageLocation
PictureBox2.ImageLocation = PictureBox1.ImageLocation