Imports System.IO
Imports System.ComponentModel

Public Class frm_create_event

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_cancel.Click

        frm_main.Show()
        Me.Close()

    End Sub

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

        GetCountryList(cbo_country)
        cbo_type.SelectedIndex = 1
        dtp_start_enroll.MinDate = Date.Today

    End Sub

    Private Sub dtp_start_enroll_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtp_start_enroll.ValueChanged

        dtp_end_enroll.MinDate = dtp_start_enroll.Value

    End Sub

    Private Sub dtp_end_enroll_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtp_end_enroll.ValueChanged

        dtp_weigh_date.MinDate = dtp_end_enroll.Value

    End Sub

    Private Sub dtp_weigh_date_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtp_weigh_date.ValueChanged

        dtp_start_date.MinDate = dtp_weigh_date.Value

    End Sub

    Private Sub dtp_start_date_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtp_start_date.ValueChanged

        dtp_end_date.MinDate = dtp_start_date.Value

    End Sub

    Private Sub btn_create_Click(sender As Object, e As EventArgs) Handles btn_create.Click

        Try
            Dim takeone_event As New platformevent(txt_title.Text, cbo_type.Text, txt_rounds.Text, txt_organizor.Text, cbo_country.SelectedValue, txt_address.Text, txt_location.Text, txt_courts.Text, txt_rules.Text, cbo_currency.Text, txt_fee.Text, dtp_start_enroll.Text, dtp_end_enroll.Text, dtp_weigh_date.Text, dtp_start_date.Text, dtp_end_date.Text, pb_event_logo)
            EventList(frm_main.lst_events)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub pb_event_logo_Click(sender As Object, e As EventArgs) Handles pb_event_logo.Click

        ResizePicture(pb_event_logo, 500, 500)

    End Sub

    Private Sub frm_create_event_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing

        frm_main.Show()

    End Sub

    Private Sub cbo_type_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbo_type.SelectedIndexChanged

        If cbo_type.Text = "LEAGUE" Then
            txt_rounds.Visible = True
            lbl_round.Visible = True
        Else
            txt_rounds.Visible = False
            lbl_round.Visible = False
        End If

    End Sub

    Private Sub cbo_country_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbo_country.SelectedIndexChanged

        Dim country As country

        Try
            country = New country(cbo_country.SelectedValue)
            pb_flag.Image = Image.FromStream(country.Flag)
        Catch ex As Exception

        End Try

    End Sub

End Class