|
static bool IsDateTimeOk(string input)
{
try
{
int year = int.Parse(input.Substring(0, 2)) + 2000;
int month = int.Parse(input.Substring(2, 2));
int day = int.Parse(input.Substring(4, 2));
int maxDaysInFeb = 28;
if(year % 4 == 0 && year % 100 != 0 && year % 400 == 0)
maxDaysInFeb = 29;
if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
if(day >= 1 && day <= 31)
return true;
else if(month != 2)
if(day >= 1 && day <= 30)
return true;
else
if(day >= 1 && day <= maxDaysInFeb)
return true;
return false;
}
catch
{
return false;
}
}
|
|
|
|
|
Thanks, I'll give this a try, after I delete the try/catch...
VagaBond
|
|
|
|
|
Hi folks,
I have 2 forms, forn1 and form2, how can I access or reference form1 from form2?
Thanks, Ben.
|
|
|
|
|
by creating instance of form1 in form2
form1 frm = new form1();
rahul
|
|
|
|
|
Perfect, thanks
|
|
|
|
|
How to open particular tabpage when click mouse-right button?
|
|
|
|
|
i have 2 functions:
void Log(LogTypes type, string message, string context);
void Log(LogTypes type, string message, params object[] parameters);
when i use the following call:
Logger.Log(LogTypes.Message, "{0} test", "ddd"); // the "{0}" will be
// replaced by "ddd" in format message
i get to a problem - how can i force the usage of either one of the functions in the call (for example - one time i want "ddd" to be a context and in another - be a parameter)
Any ideas?
Thanks.
|
|
|
|
|
The easiest way I can think of is make Context a class called "LogContext". It could be as simple as a wrapper around a string, but at least it differentiates it from a string parameter used in the params argument.
One other point, in the naming of your enum. Enums should be singular tense, unless it can be used in a bitmasked way (ie/ are marked with the FlagsAttribute).
so for example,
LogType.Message <-- singlular as you can only use one at a time
UserGroups.User | UserGroups.Administrator <-- example of bitmasked enums
|
|
|
|
|
Thanks. this would probably be the best solution.
|
|
|
|
|
how can i set the databindings for datagrid to dataview?
thanks for help,
MD_NADA
|
|
|
|
|
u can create dataview by following way and then can bind it to datagrid
DataView dv = new DataView(dataset.Tables[0],"","",DataViewRowState.CurrentRows);
dataGrid1.DataSource = dv;
rahul
|
|
|
|
|
excuse me
first thanks for help
i want to set the DataBindings property for datagrid by dataview
but it send me an exception here is the code i wrote
custadd=new DataView(customer.Tables["address"],"","",DataViewRowState.CurrentRows );
custadd.AllowEdit=true;
custadd.AllowNew=true;
custadd.AllowDelete=true;
custadd.Table =customer.Tables["address"];
custadd.RowFilter="cust_ID='"+txid.Text+"'";
dataGrid1.DataBindings.Add("DataSource",custadd, );
the databindings takes the arguments but i do not know the 3 argument
thanks
MD_NADA
|
|
|
|
|
Is there any specific coding standards as such for C#.
Can anyone provide me with a link from where i can get. Or is there any standards for C# which microsoft has provide.
Regards
Nasim
where there is a will there is a way
|
|
|
|
|
|
thanks michael
have a nice day
where there is a will there is a way
|
|
|
|
|
Hi all,
I wanted to find out what the best way to print user customized pages would be.
The user would customize :-
1. what size of print they want in centimetres. if less than normal A4 size it should then customize how many prints on one page
2. what images he wants on the page + their location on page.
3. Must also have the capability to print bar codes
I have already tried generating the page as HTML and printing it but thats not working out the best.
Please let me know...
|
|
|
|
|
Hey dude there is a whole section on printing in www.C-sharpCorner.com there you will most probably find what you are looking for.
Oliekrokenosterpikkelikkeastrysvoel
|
|
|
|
|
hI can anybody tell me how can i make a copy of one worksheet (excel) in the same work book .. i tried worksheets.copy method .. but it copies all the work sheets .. can any body suggest an idea???
Thanx
Akhil
|
|
|
|
|
u can point to the worksheet and then copy.. i think u r trying the worksheets object
regards,
abhishek
"If u believe in psychokinesis then raise my hand."
|
|
|
|
|
Hi All,
I am using Access database.
I want to store image/excel file for this purpose i decide to use OLE object datatype of access.But could not get sample code for my purpose.
If anyone know any link please pass to me.
Thanks,
Nagraj
|
|
|
|
|
I want my software to be installed only after the installtion key provided by me. please tell me how can i do that.
I have developed my project in C#.net and I am using Visual Studio.net 2003.
shah khalid
shah khalid
|
|
|
|
|
hard code ur Key to ur program and check with the input. if the input matches the Key u hardcoded into ur project, execute it or else just pop up a message telling wrong product key! Try again.
Vipin
|
|
|
|
|
Have you made any software if yes than please tell me which software you have made.
|
|
|
|
|
|
probably u can get the time from the server from which ur web application is running which can be linked to ur window application.
Vipin
|
|
|
|