图像显示在另一个表单上的文本框中的详细信息

时间:2015-08-28 12:27:12

标签: vb.net

为什么我的代码不起作用,在form4中你可以上传一张图片,然后在那里有一个文本框,你可以在那里输入图片的详细信息然后如果你点击提交按钮,Form5将会显示你上传的图片4将在form5图片框中显示,form4中文本框中的键入详细信息也将显示在form5 label1中。你能纠正我的代码(我没有使用数据库) 当我已经上传图片时,输入详细信息并单击它不会在form5上显示的提交按钮

Public Class Form4

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim file As New OpenFileDialog

    file.Filter = "Image files | *.png; *.jpg; *.gif |" & _
                    "All files (*.*) | *.*"
    file.FilterIndex = 1

    If file.ShowDialog = Windows.Forms.DialogResult.OK Then
        PictureBox1.ImageLocation = file.FileName
    End If
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    Me.Hide()
    Form3.Show()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Me.PictureBox1.Image = Form5.PictureBox1.Image
    Me.TextBox1.Text = Form5.Label1.Text

    MsgBox("Ad Posted!", MsgBoxStyle.Information)
    Me.Hide()
    Form5.Show()
    TextBox1.Clear()

End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    Dim lbutton As DialogResult
    lbutton = MessageBox.Show("Do you want to logout now?", "Logging out", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    If lbutton = DialogResult.Yes Then
        Form1.Show()
        Me.Hide()
    End If
End Sub

Private Sub Form4_Load(sender As Object, e As EventArgs) Handles     MyBase.Load
    SetStyle(ControlStyles.SupportsTransparentBackColor, True)
End Sub
End Class

0 个答案:

没有答案