membuat kalender menggunakan vb.net

‘ seperti biasa saya tidak bisa berucap banyak anda cukup copy pastekan kode ini dan jangan lupa di compile…..

Public Class Form1
Inherits System.Windows.Forms.Form

#Region ” Windows Form Designer generated code ”
#End Region

Public Class tanggal
Inherits System.Windows.Forms.Label
End Class
Private datatanggal() As tanggal

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ReDim datatanggal(36)
Dim i, labelatas, labelkiri, totalbaris, totalkolom
labelatas = 30
labelkiri = 30
totalbaris = 1
totalkolom = 1
For i = 0 To 36
datatanggal(i) = New tanggal
datatanggal(i).BackColor = System.Drawing.Color.Transparent
datatanggal(i).Font = New System.Drawing.Font(“Microsoft Sans Serif”, 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
datatanggal(i).ForeColor = System.Drawing.Color.Lime
datatanggal(i).Text = i + 1
datatanggal(i).Top = labelatas
datatanggal(i).Left = labelkiri
datatanggal(i).Width = 20
Me.Controls.Add(datatanggal(i))
totalbaris = totalbaris + 1
totalkolom = totalkolom + 1
labelkiri = labelkiri + 60
If totalbaris > 7 Then
labelatas = labelatas + 30
totalbaris = 1
End If
If totalkolom > 7 Then
labelkiri = 30
totalkolom = 1
End If
datatanggal(i).Visible = False
Next
cektanggal(TextBox1.Text, TextBox2.Text)
End Sub
Private Function cektanggal(ByVal bulan As Integer, ByVal tahun As Integer)
Dim Totalhari, haripertama, namabulan, mulai
Dim tanggal As Date
Dim i

For i = 0 To 36
datatanggal(i).Visible = False
Next

If bulan = 1 Then
namabulan = “Jan”
ElseIf bulan = 2 Then
namabulan = “Feb”
ElseIf bulan = 3 Then
namabulan = “Mar”
ElseIf bulan = 4 Then
namabulan = “Apr”
ElseIf bulan = 5 Then
namabulan = “May”
ElseIf bulan = 6 Then
namabulan = “Jun”
ElseIf bulan = 7 Then
namabulan = “Jul”
ElseIf bulan = 8 Then
namabulan = “Aug”
ElseIf bulan = 9 Then
namabulan = “Sep”
ElseIf bulan = 10 Then
namabulan = “Oct”
ElseIf bulan = 11 Then
namabulan = “Nov”
ElseIf bulan = 12 Then
namabulan = “Dec”
End If

Totalhari = Now.DaysInMonth(tahun, bulan)
tanggal = “#1/” & namabulan & “/” & tahun & “#”
haripertama = Format(tanggal, “ddd”)

If haripertama = “Sun” Then
mulai = “0”
ElseIf haripertama = “Mon” Then
mulai = “1”
ElseIf haripertama = “Tue” Then
mulai = “2”
ElseIf haripertama = “Wed” Then
mulai = “3”
ElseIf haripertama = “Thu” Then
mulai = “4”
ElseIf haripertama = “Fri” Then
mulai = “5”
ElseIf haripertama = “Sat” Then
mulai = “6”
End If

For i = 0 To Totalhari – 1
datatanggal(mulai).Visible = True
datatanggal(mulai).Text = i + 1
mulai += 1
Next
End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cektanggal(TextBox1.Text, TextBox2.Text)
If TextBox1.Text = 1 Then
Label10.Text = “JANUARI”
ElseIf TextBox1.Text = 2 Then
Label10.Text = “PEBRUARI”
ElseIf TextBox1.Text = 3 Then
Label10.Text = “MARET”
ElseIf TextBox1.Text = 4 Then
Label10.Text = “APRIL”
ElseIf TextBox1.Text = 5 Then
Label10.Text = “MEI”
ElseIf TextBox1.Text = 6 Then
Label10.Text = “JUNI”
ElseIf TextBox1.Text = 7 Then
Label10.Text = “JULI”
ElseIf TextBox1.Text = 8 Then
Label10.Text = “AGUSTUS”
ElseIf TextBox1.Text = 9 Then
Label10.Text = “SEPTEMBER”
ElseIf TextBox1.Text = 10 Then
Label10.Text = “OKTOBER”
ElseIf TextBox1.Text = 11 Then
Label10.Text = “NOPEMBER”
ElseIf TextBox1.Text = 12 Then
Label10.Text = “DESEMBER”
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class

4 Responses

  1. jelek

  2. wah komentarnya kurang memuaskan
    yawis saia tak nulis yg lebih bagus lagi

  3. pljrn anak2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: