Public Class Form1
Structure StructAthlete
Dim strname As String
Dim strlast As String
Dim strid As String
Dim intage As Integer
Dim strsex As String
Dim intheight As Integer
Dim intweight As Integer
End Structure
Private ArLsAthlete As New ArrayList
Private Sub btngetdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btngetdata.Click
If txtid.Text = "" Or txtname.Text = "" Or txtlast.Text = "" Or txtsex.Text = "" Or txtage.Text = "" Or txtheight.Text = "" Or txtweight.Text = "" Then
'ตรวจสอบว่ากรอกข้อมูลครบหรือไม่
MessageBox.Show("คุณกรอกข้อมูลไม่ครบ", "error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Dim StructData As StructAthlete
StructData.strid = txtid.Text
StructData.strname = txtname.Text
StructData.strlast = txtlast.Text
StructData.intage = txtage.Text
StructData.intweight = txtweight.Text
StructData.strsex = txtsex.Text
StructData.intheight = txtheight.Text
ArLsAthlete.Add(StructData)
MessageBox.Show("รหัสนักกีฬา" & StructData.strid & "ชื่อ" & StructData.strname & "นามสกุล" & StructData.strlast & "อายุ" & StructData.intage & "น้ำหนัก" & StructData.intweight)
End Sub
End Class