Advertisement
arlendafitranto

Form1

Nov 7th, 2024 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.06 KB | Source Code | 0 0
  1. Public Class Form1
  2.  
  3.     Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
  4.         Application.Exit()
  5.     End Sub
  6.  
  7.     ' Save Button: Displays the entered data in a message box
  8.     Private Sub btnSimpan_Click(sender As Object, e As EventArgs) Handles btnSimpan.Click
  9.         ' Check if any required field is empty
  10.         nama = txtNama.Text
  11.         tempatLahir = txtTempat.Text
  12.         tanggalLahir = dtpTanggal.Value.ToString("dd MMMM yyyy")
  13.         gender = If(rbtnLaki.Checked, "Laki-laki", If(rbtnPerempuan.Checked, "Perempuan", String.Empty))
  14.         agama = cbAgama.SelectedItem?.ToString()
  15.         asalSekolah = txtAsal.Text
  16.         noHP = txtNo.Text
  17.         alamat = txtAlamat.Text
  18.         email = txtEmail.Text
  19.         namaAyah = txtAyah.Text
  20.         namaIbu = txtIbu.Text
  21.         noHPO = txtNoHPO.Text
  22.  
  23.         If String.IsNullOrWhiteSpace(nama) OrElse
  24.            String.IsNullOrWhiteSpace(tempatLahir) OrElse
  25.            String.IsNullOrWhiteSpace(gender) OrElse
  26.            String.IsNullOrWhiteSpace(agama) OrElse
  27.            String.IsNullOrWhiteSpace(asalSekolah) OrElse
  28.            String.IsNullOrWhiteSpace(noHP) OrElse
  29.            String.IsNullOrWhiteSpace(alamat) OrElse
  30.            String.IsNullOrWhiteSpace(email) OrElse
  31.            String.IsNullOrWhiteSpace(namaAyah) OrElse
  32.            String.IsNullOrWhiteSpace(namaIbu) OrElse
  33.            String.IsNullOrWhiteSpace(noHPO) Then
  34.  
  35.             MessageBox.Show("Harap isi semua data yang diperlukan.", "Data Tidak Lengkap", MessageBoxButtons.OK, MessageBoxIcon.Warning)
  36.             Return
  37.         End If
  38.  
  39.         btnSimpan.Enabled = False
  40.         btnLanjutkan.Enabled = True
  41.     End Sub
  42.  
  43.     ' Lanjutkan Button: Opens the next form (Form2)
  44.     ' Lanjutkan Button: Opens the next form (Form2) if all required fields are filled
  45.     Private Sub btnLanjutkan_Click(sender As Object, e As EventArgs) Handles btnLanjutkan.Click
  46.  
  47.         ' Open Form2 and hide the current form
  48.         Dim form2 As New Form2()
  49.         form2.Show()
  50.         Me.Hide()
  51.     End Sub
  52.  
  53.    
  54. End Class
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement