This Code Unit Helps To Loads Years To A ComboBix in C#, That Are Between Two Given Dates.You Can Modify This Code Unit and You Can Get The Dates From Either User Input or Database Values.
In Order To Do That I'm Using A Function Called CmbYearLoad()
This Method Has Two String Variables Called sStartDate and sEndDate.
This Variables Stores The Values Of Dates.
private void CmbYearLoad()
{
string sStartDate = "06-22-2003";//This Value Can be Either From Database or User Input
string sEndDate = "12-15-2013";
DateTime dtStartDate = Convert.ToDateTime(sStartDate);
DateTime dtEndDate = Convert.ToDateTime(sEndDate);
int iStartYear = dtStartDate.Year;//Getting The Relevant Year Of The Date
int iEndYear = dtStartDate.Year;
CmbYear.Items.Clear();
for (int iYearCount = iEndYear; iYearCount >= iStartYear; iYearCount--)
{
CmbYear.Items.Add(iYearCount);
}
CmbYear.SelectedIndex = 0;
}
Subscribe to:
Post Comments (Atom)
JWT Token Decode Using Jquery
When it come to authentication we use many mechanism. Ones the user authenticated we must keep these details somewhere safe. So we can share...
-
In this blog post Ill explain you the logic behind the Sri Lankan National Identity Card (NIC). Sri Lanka now has Old NIC No Format as well ...
-
In This Article I Will Demonstrate You To Create A Simple Chat Program Using Java Remote Method Invocation(RMI). Following Program Supports ...
-
In a windows form application sometimes you may want to import a excel file to a data grid view. In this blog post Ill demonstrate to you gu...
No comments:
Post a Comment