Tuesday, April 05, 2005
Get No Of Days In Month
GetNoOfDaysInMonth
Function (dateTimeVar investmentPaidDate)
numberVar intDay := 1;
dateVar monthStartDate := CDate (Year (investmentPaidDate), Month (investmentPaidDate) ,1) ;
dateVar monthEndDate := CDate (Year (investmentPaidDate), (Month (investmentPaidDate))+1 ,1);
monthEndDate = DateAdd ("d", -1 , monthEndDate );
intDay = DateDiff ("d", monthStartDate , monthEndDate );
intDay;
Function (dateTimeVar investmentPaidDate)
numberVar intDay := 1;
dateVar monthStartDate := CDate (Year (investmentPaidDate), Month (investmentPaidDate) ,1) ;
dateVar monthEndDate := CDate (Year (investmentPaidDate), (Month (investmentPaidDate))+1 ,1);
monthEndDate = DateAdd ("d", -1 , monthEndDate );
intDay = DateDiff ("d", monthStartDate , monthEndDate );
intDay;
Get No Of days in Year
GetNoOfDaysInYear
Function (dateTimeVar investmentDate)
numberVar intDay := 1;
dateVar yearStartDate := CDate (Year (investmentDate), 1 , 1) ;
dateVar yearEndDate := CDate (Year (investmentDate), 12 , 31);
intDay = DateDiff ("d", yearStartDate , yearEndDate );
intDay;
Function (dateTimeVar investmentDate)
numberVar intDay := 1;
dateVar yearStartDate := CDate (Year (investmentDate), 1 , 1) ;
dateVar yearEndDate := CDate (Year (investmentDate), 12 , 31);
intDay = DateDiff ("d", yearStartDate , yearEndDate );
intDay;
ESC key
Do this
create a button on the same form where you have to get hold of ESC key!
in the form properties check out CancelButton and set its value to the the button designed right now. now write the routine for that button if it is clicked.
you can also assign it at runtime like this:
(C#) this.CancelButton=button24;
(VB.NET) Me.CancelButton=button24
With Best Regards,
Mitesh V. Mehta
create a button on the same form where you have to get hold of ESC key!
in the form properties check out CancelButton and set its value to the the button designed right now. now write the routine for that button if it is clicked.
you can also assign it at runtime like this:
(C#) this.CancelButton=button24;
(VB.NET) Me.CancelButton=button24
With Best Regards,
Mitesh V. Mehta
Pivot Tables with ADO.NET and Display in Horizontal Paged DataGrid
This article describes a simple method to pivot a DataTable producing rows for each column and a column for each row. The pivoted DataTable is then displayed in a DataGrid using horizontal paging to view a limited number of Columns in each page. This is a common display technique used to compare, for instance, product features, where the product names appear across the top of the DataGrid with the Features listed down the side.
http://aspalliance.com/538
http://aspalliance.com/538
How to write an Office Plug-In/Add-In Using C#.NET
There are many Win/Web applications where we would use Office...this
article throws light on how to add office plug-in/add-in using C#.NET
into your application.
Pls find more information about article here...
http://msd2d.com/newsletter_tip.aspx?section=dotNet&category=C%20Sharp&id=e2227b60-6db6-4933-921a-88a1cd227c4f
With Best Regards,
Mitesh V. Mehta
article throws light on how to add office plug-in/add-in using C#.NET
into your application.
Pls find more information about article here...
http://msd2d.com/newsletter_tip.aspx?section=dotNet&category=C%20Sharp&id=e2227b60-6db6-4933-921a-88a1cd227c4f
With Best Regards,
Mitesh V. Mehta
String Enumerators
using System;
using System.Reflection;
enum EnumError
{
OverLimit,
UnderLimit,
Normal,
}
class EnumErrorDescriptions
{
const string OverLimit = "Oh you have exceeds your limit!";
const string UnderLimit = "Oh! you are much below your limit!";
const string Normal = "Oh! you are within your limit!";
internal static string GetErrorMessage (EnumError err)
{
string enumName = err.ToString();
FieldInfo fi = typeof(EnumErrorDescriptions).GetField
(enumName, BindingFlags.Static|BindingFlags.NonPublic);
if (fi==null)
{
// Oops! You could throw an exception here if you wanted -
// or return another constant, maybe.
return "Unknown error";
}
return (string)fi.GetValue(null);
}
}
class Test
{
static void Main()
{
Console.WriteLine (EnumErrorDescriptions.GetErrorMessage
(EnumError.OverLimit));
}
}
Basically enum provides only integer values, but through this mechanism you can get string values through enum (string enumeration).
With Best Regards,
Mitesh V. Mehta
using System.Reflection;
enum EnumError
{
OverLimit,
UnderLimit,
Normal,
}
class EnumErrorDescriptions
{
const string OverLimit = "Oh you have exceeds your limit!";
const string UnderLimit = "Oh! you are much below your limit!";
const string Normal = "Oh! you are within your limit!";
internal static string GetErrorMessage (EnumError err)
{
string enumName = err.ToString();
FieldInfo fi = typeof(EnumErrorDescriptions).GetField
(enumName, BindingFlags.Static|BindingFlags.NonPublic);
if (fi==null)
{
// Oops! You could throw an exception here if you wanted -
// or return another constant, maybe.
return "Unknown error";
}
return (string)fi.GetValue(null);
}
}
class Test
{
static void Main()
{
Console.WriteLine (EnumErrorDescriptions.GetErrorMessage
(EnumError.OverLimit));
}
}
Basically enum provides only integer values, but through this mechanism you can get string values through enum (string enumeration).
With Best Regards,
Mitesh V. Mehta