shampoy 0 Newbie Poster

what is the code to validate my upload pic..

this is the first form

Imports System
Imports System.IO
Imports System.Data

Public Class ApplicantsInfo1
    Private path As Bitmap
    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
        ApplicantsInfo2.Close()
        ApplicantsInfo3.Close()
        ApplicantsView.Show()
        ApplicantsView.pageInit()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        

        ApplicantsInfo2.Show()
        Me.Hide()
    End Sub

    Private Sub ApplicantsInfo1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ClearFields()
    End Sub

    Private Sub ClearFields()
        txtLastname.Clear()
        txtFirstname.Clear()
        txtMiddlename.Clear()
        txtTelephoneNo.Clear()
        txtCellphoneNo.Clear()
        cboxGender.SelectedIndex = 0
        txtHeight.Clear()
        txtWeight.Clear()
        cboxCivilStatus.SelectedIndex = 0
        txtAddress.Clear()
        txtReligion.Clear()
        txtNationality.Clear()
        datePickerBirthDate.Value = "1 / 1 / 1950"
        txtPlaceOfBirth.Clear()
        txtSpouseName.Clear()
        cboxChildrenNumber.SelectedIndex = 0
        txtChildrensname.Clear()
        txtContactEmergencyName.Clear()
        OpenFileDialog1.FileName = 0
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ClearFields()
    End Sub

   [I] Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  
        
        OpenFileDialog1.ShowDialog()

        If OpenFileDialog1.FileName = String.Empty Then
            Return
        Else

            Button2.Text = OpenFileDialog1.FileName

        End If
        Dim filePath As String = Button2.Text
        Dim fnPeices() As String = filePath.Split("\")
        Dim fileName As String = ""

        fileName = fnPeices(fnPeices.Length - 1)
        TextBox1.Text = fileName

    End Sub[/I]

    Private Sub Label13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label13.Click
        ApplicantsInfo2.Show()
        Me.Hide()
        ApplicantsInfo3.Hide()
    End Sub

    Private Sub Label15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label15.Click
        ApplicantsInfo3.Show()
        Me.Hide()
        ApplicantsInfo2.Show()
    End Sub

    Private Sub txtLastname_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLastname.TextChanged

    End Sub

    Private Sub txtPlaceOfBirth_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPlaceOfBirth.TextChanged

    End Sub

    [I]Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
        
        OpenFileDialog1.Title = "Open File"
        OpenFileDialog1.FileName = String.Empty

        Try

            OpenFileDialog1.InitialDirectory = "C:\"

        Catch ex As Exception

            MessageBox.Show(ex.Message.ToString(), "Error")

        End Try

    End Sub[/I]



    Private Sub ImageID_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImageID.Click

    End Sub
End Class

I putted whatever codes in the OpenFileDialog1 and Button2 or the browse button. while the Button1 was the next button since its a forum..

so for the last form was the validation..

Imports System.Data.OleDb
Imports System.Data

Public Class ApplicantsInfo3
    Dim data As DatabaseClass = New DatabaseClass()

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ApplicantsInfo2.Show()
        Me.Hide()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        CloseApplicantsInfo()
        
    End Sub

    Public Sub CloseApplicantsInfo()
        ApplicantsInfo1.Close()
        ApplicantsInfo2.Close()
        Me.Close()
        ApplicantsView.Show()
        ApplicantsView.pageInit()
    End Sub

   [I] Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim validate = New Validators()


        If validate.validateUserInfo() = True Then
            If ApplicantsInfo1.txtApplicantID.Text = "" Then
                data.AddApplicant()
            Else
                data.AddAnAdministrator()
            End If
        Else
            MsgBox("failed")
        End If
        'Me.Close()
        'ApplicantsInfo1.Close()
        'ApplicantsInfo2.Close()
        'ApplicantsView.Show()
        CloseApplicantsInfo()
    End Sub
[/I]

    Private Sub txtDataIssued_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ApplicantsInfo3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ClearAll()
    End Sub
    Private Sub ClearAll()
        txtLicenseNo.Clear()
        txtPassport.Clear()
        datePickerDateIssued.Text = "1 / 1 / 1950"
        txtPlaceIssued.Clear()
        txtAccountNo.Clear()
        txtBankName.Clear()
        txtSSS.Clear()
        'checkboxEULA.Checked = False
    End Sub

    Private Sub lblApplicantsInfo1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblApplicantsInfo1.Click
        ApplicantsInfo1.Show()
        Me.Hide()
        ApplicantsInfo2.Hide()
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
        ApplicantsInfo2.Show()
        Me.Hide()
        ApplicantsInfo1.Hide()
    End Sub
End Class

Button4 is the save button :/

so how can I validate it or whenever I open the edit button the picture is there

how can I validate that?

everytime I'm going or getting back to ApplicantsInfo1 form. my uploaded pic is empty. so I want to retrieve whenever editing it in my database Microsoft access. heres the code..

including database.

Imports System.Data.OleDb
Imports System.Data

Public Class ApplicantsView
    Dim data As DatabaseClass = New DatabaseClass()

    Enum Category
        All
        LastName
        Specialization
        Education
    End Enum

    Private Sub ApplicantsView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        pageInit()


    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
        SelectionModule.Show()
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        ApplicantsInfo1.Show()
        Me.Hide()
    End Sub

    Public Sub pageInit()
        txtSearch.Clear()
        cboxCategory.SelectedIndex = 0
        refreshGridView(Category.All)
    End Sub
    Public Sub gridviewInit()


        'GridViewApplicants.Columns("Height").Visible = False
        'GridViewApplicants.Columns("Weight").Visible = False
        'GridViewApplicants.Columns("Address").Visible = False
        'GridViewApplicants.Columns("Religion").Visible = False
        'GridViewApplicants.Columns("Nationality").Visible = False
        'GridViewApplicants.Columns("PlaceofBirth").Visible = False
        'GridViewApplicants.Columns("Spouse").Visible = False
        'GridViewApplicants.Columns("ChildrenNumber").Visible = False
        'GridViewApplicants.Columns("Children").Visible = False
        'GridViewApplicants.Columns("ContactPersoninEmergency").Visible = False
        'GridViewApplicants.Columns("BankAccountNumber").Visible = False
        'GridViewApplicants.Columns("Bankname").Visible = False
        'GridViewApplicants.Columns("SSSNumber").Visible = False

    End Sub

    Public Sub refreshGridView(ByVal searchCategory As Category)
        Dim conn As New OleDb.OleDbConnection
        conn.ConnectionString = data.getconnString()
        conn.Open()

        Try
            Dim dataAdapter As New OleDb.OleDbDataAdapter
            Dim dataSet As New DataSet
            dataSet.Clear()

            Dim CommGetApplicants = New OleDbCommand()
            CommGetApplicants.Connection = conn

            If searchCategory = Category.All Then
                CommGetApplicants.CommandText = "GetApplicants"
                CommGetApplicants.CommandType = CommandType.StoredProcedure
                dataAdapter.SelectCommand = CommGetApplicants
                dataAdapter.Fill(dataSet, "Applicants")

            ElseIf searchCategory = Category.LastName Then
                CommGetApplicants.CommandText = "SELECT * FROM Applicant WHERE Surname LIKE '%" & txtSearch.Text & "%'"
                dataAdapter.SelectCommand = CommGetApplicants
                dataAdapter.Fill(dataSet, "Applicants")
            End If

            GridViewApplicants.DataSource = Nothing
            GridViewApplicants.DataSource = dataSet.Tables("Applicants")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Me.GridViewApplicants.Columns("ApplicantId").Visible = False
    End Sub

    Private Sub cboxCategory_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboxCategory.SelectedIndexChanged

        
    End Sub

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Select Case cboxCategory.SelectedIndex
            Case 0
                refreshGridView(Category.All)
                Exit Select
            Case 1
                refreshGridView(Category.LastName)
                Exit Select
            Case 2
                refreshGridView(Category.Education)
                Exit Select
            Case 3
                refreshGridView(Category.Specialization)
                Exit Select
            Case Else
                refreshGridView(Category.All)
        End Select
    End Sub

    Private Sub GridViewApplicants_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GridViewApplicants.SelectionChanged
     
    End Sub

    Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
        If Not GridViewApplicants.CurrentRow.Index >= 0 Then
            MsgBox("please select to edit")
        Else
            ApplicantsInfo1.Show()
            ApplicantsInfo2.Show()
            ApplicantsInfo2.Hide()
            ApplicantsInfo3.Show()
            ApplicantsInfo3.Hide()
            Dim ID = GridViewApplicants.CurrentRow.Index
            data.getAnApplicant(Convert.ToInt16(GridViewApplicants.Item(0, ID).Value))
        End If
    End Sub

    Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        If Not GridViewApplicants.CurrentRow.Index >= 0 Then
            MsgBox("please select to delete")
        Else
            Dim ID = GridViewApplicants.CurrentRow.Index
            data.deleteAnApplicant(Convert.ToInt16(GridViewApplicants.Item(0, ID).Value))
            MsgBox("Record Deleted")
            refreshGridView(Category.All)
        End If
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged

    End Sub

    Private Sub GridViewApplicants_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles GridViewApplicants.CellContentClick

    End Sub
End Class

what code should I add or edit? please I really need it.