Click here to Skip to main content
15,890,185 members
Home / Discussions / C#
   

C#

 
Questionclearing all event handlers Pin
mintguy7-Feb-06 0:09
mintguy7-Feb-06 0:09 
AnswerRe: clearing all event handlers Pin
James Gupta7-Feb-06 1:40
professionalJames Gupta7-Feb-06 1:40 
GeneralRe: clearing all event handlers Pin
mintguy7-Feb-06 3:40
mintguy7-Feb-06 3:40 
GeneralRe: clearing all event handlers Pin
Dave Kreskowiak7-Feb-06 4:11
mveDave Kreskowiak7-Feb-06 4:11 
GeneralRe: clearing all event handlers Pin
James Gupta8-Feb-06 5:06
professionalJames Gupta8-Feb-06 5:06 
QuestionHow to find out if a cell is a date field in Excel Pin
thestonefox6-Feb-06 22:57
thestonefox6-Feb-06 22:57 
AnswerRe: How to find out if a cell is a date field in Excel Pin
Curtis Schlak.7-Feb-06 3:34
Curtis Schlak.7-Feb-06 3:34 
GeneralRe: How to find out if a cell is a date field in Excel Pin
thestonefox7-Feb-06 5:06
thestonefox7-Feb-06 5:06 
thanks for the info, ive managed to do it in one of the longest winded ways ive ever had to do something in my life of programming!

<br />
private string excelSerialDateToDMY(int serialDate)<br />
{<br />
int nDay;<br />
int nMonth;<br />
int nYear;<br />
// Excel/Lotus 123 have a bug with 29-02-1900. 1900 is not a<br />
// leap year, but Excel/Lotus 123 think it is...<br />
if (serialDate == 60)<br />
{<br />
nDay    = 29;<br />
nMonth    = 2;<br />
nYear    = 1900;<br />
		<br />
return "29/02/1900";<br />
}<br />
else if (serialDate < 60)<br />
{<br />
// Because of the 29-02-1900 bug, any serial date <br />
// under 60 is one off... Compensate.<br />
serialDate++;<br />
}<br />
		<br />
// Modified Julian to DMY calculation with an addition of 2415019<br />
int l = serialDate + 68569 + 2415019;<br />
int n = ( 4 * l ) / 146097;<br />
l = l - ( 146097 * n + 3 ) / 4;<br />
int i = ( 4000 * ( l + 1 ) ) / 1461001;<br />
l = l - ( 1461 * i ) / 4 + 31;<br />
int j = ( 80 * l ) / 2447;<br />
nDay = l - ( 2447 * j ) / 80;<br />
l = j / 11;<br />
nMonth = j + 2 - ( 12 * l );<br />
nYear = 100 * ( n - 49 ) + i + l; <br />
return nDay+"/"+nMonth+"/"+nYear;<br />
}<br />
<br />
public bool inArray(object key, object[] array)<br />
{<br />
for (int c=0; c<array.Length; c++)<br />
{<br />
if (array[c].Equals(key))<br />
return true;<br />
}<br />
return false;<br />
}<br />
<br />
//main code snippet here<br />
string[] dateArray={"dd/mm/yyyy","[$-F800]dddd, mmmm dd, yyyy","dd/mm/yyyy;@","dd/mm/yy;@","d/m/yy;@","d.m.yy;@","yyyy-mm-dd;@","[$-809]dd mmmm yyyy;@","[$-809]d mmmm yyyy;@"};<br />
<br />
//Get a cell in the excel sheet and call it myCell<br />
//get the numberformat of the cell and call it myType<br />
//get the value of the cell<br />
<br />
//if the numberformat is of any of the know date formats then do this<br />
if (inArray(myType.ToString(),dateArray))<br />
{<br />
string retDate=excelSerialDateToDMY(Int32.Parse(myVal.ToString()));<br />
System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-GB");<br />
DateTime myDate = DateTime.Parse(retDate,culture,System.Globalization.DateTimeStyles.NoCurrentDateDefault);	<br />
return myDate.ToShortDateString();<br />
}<br />
//else just return the value of the cell<br />
else <br />
return myVal.ToString();<br />


i hope this helps someone else in the future
QuestionHow can I implement a C++ interface in C# Pin
tiancaidao6-Feb-06 22:37
tiancaidao6-Feb-06 22:37 
AnswerRe: How can I implement a C++ interface in C# Pin
Kiran Kumar Singani6-Feb-06 23:37
Kiran Kumar Singani6-Feb-06 23:37 
GeneralRe: How can I implement a C++ interface in C# Pin
tiancaidao7-Feb-06 16:58
tiancaidao7-Feb-06 16:58 
QuestionFetching dynamically generated data from a string of 10 lines using C# Pin
H he el el oooo6-Feb-06 22:16
H he el el oooo6-Feb-06 22:16 
AnswerRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
leppie6-Feb-06 22:19
leppie6-Feb-06 22:19 
GeneralRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
J4amieC6-Feb-06 23:59
J4amieC6-Feb-06 23:59 
GeneralRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
leppie7-Feb-06 0:35
leppie7-Feb-06 0:35 
AnswerRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
J4amieC7-Feb-06 0:02
J4amieC7-Feb-06 0:02 
QuestionAbout attachments ?????!!!!!! Pin
students552 university6-Feb-06 21:41
students552 university6-Feb-06 21:41 
AnswerRe: About attachments ?????!!!!!! Pin
J4amieC6-Feb-06 23:54
J4amieC6-Feb-06 23:54 
Questionmoving an object in a panel Pin
hpetriffer6-Feb-06 20:23
hpetriffer6-Feb-06 20:23 
QuestionDeployment Pin
JacquesDP6-Feb-06 19:46
JacquesDP6-Feb-06 19:46 
AnswerRe: Deployment Pin
mav.northwind6-Feb-06 21:29
mav.northwind6-Feb-06 21:29 
QuestionRe: Deployment Pin
JacquesDP6-Feb-06 22:04
JacquesDP6-Feb-06 22:04 
AnswerRe: Deployment Pin
mav.northwind7-Feb-06 0:02
mav.northwind7-Feb-06 0:02 
GeneralRe: Deployment Pin
JacquesDP7-Feb-06 0:38
JacquesDP7-Feb-06 0:38 
QuestionRe: Deployment Pin
JacquesDP6-Feb-06 22:58
JacquesDP6-Feb-06 22:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.