Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
' يعمل فقط إذا كان نوع تقويم النظام التاريخ الهجري ولا يعمل مع نوع تقويم النظام تقويم أم القرى '
' (+2), (+1), (0), (-1), (-2) :المجال فقط يومان زيادة أو نقصان '
If AddHijriDate(-1) Then
Dim hijri As New Globalization.HijriCalendar
MsgBox(Now.Date)
End If
End Sub
Private Function AddHijriDate(days As Integer) As Boolean
Try
' ملاحظات هامة '
' يعمل فقط إذا كان نوع تقويم النظام التاريخ الهجري ولا يعمل مع نوع تقويم النظام تقويم أم القرى '
' (+2), (+1), (0), (-1), (-2) :المجال المسموح به فقط يومان زيادة أو نقصان '
If Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Control Panel\International") _
.GetValue("iCalendarType") = 6 _
Then
If Math.Abs(days) > 2 Then
MsgBox("عفواً.. مجال الأيام المسموح به من (-2 إلى +2)", _
MsgBoxStyle.Exclamation + MsgBoxStyle.MsgBoxRight + MsgBoxStyle.MsgBoxRtlReading)
Return False
End If
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Control Panel\International", True) _
.SetValue("AddHijriDate", "AddHijriDate" & If(days < 0, days, "+" & days))
Return True
Else
MsgBox("عفواً.. نوع تقويم النظام يجب أن يكون التاريخ الهجري", _
MsgBoxStyle.Exclamation + MsgBoxStyle.MsgBoxRight + MsgBoxStyle.MsgBoxRtlReading)
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
End Class