|
I am trying to understand the underlying code of the colors class, so i can replcate it for a differnt use. It has the functionality i need, but i am going to use it for something other than colors
|
|
|
|
|
ahh then you may want to use an 'enum'
public enum Values{
One = 1
Two = 2
}
then acces like
Values.One
or Values.Two
modified on Thursday, January 8, 2009 12:28 PM
|
|
|
|
|
thats the kind of functionality i need, but it need to display structs, which is where i start getting stuck
|
|
|
|
|
You could examine the source of the Color struct.
A very simple implementation (loads missed out!) using the proper spelling...
public struct Colour
{
private byte m_R;
private byte m_G;
private byte m_B;
public Colour(byte r, byte g, byte b)
{
m_R = r;
m_G = g;
m_B = b;
}
public byte R { get { return m_R; } }
public byte G { get { return m_G; } }
public byte B { get { return m_B; } }
public static Colour White
{
get { return new Colour(255, 255, 255); }
}
public static Colour Black
{
get { return new Colour(0, 0, 0); }
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
EDIT - Scratch that, i have worked out how the above sorts everything out for me
THANKS
I agree about the spelling
|
|
|
|
|
yeah thats what i meant to write lol
|
|
|
|
|
Can you recommend some free reliable source control software? Thanks
|
|
|
|
|
|
You may get answers here - but a better place may be in the lounge (if you do - link to this thread so you don't get flamed for cross posting!). If you do a search there first you'll see that it's been discussed many times and will probably save you the trouble of posting.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I prefer Subversion[^], but you may want to use a different version system based on your needs.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I've been working on a so called 'TextControl' which is a label, but without the padding that is added in 'normal' labels.
I think all majour features have been implemented, so I was wondering if I should create an article about that..
|
|
|
|
|
If you feel it is going to be interesting for people, and if you've had some interesting solution, then why not, go ahead
Regards,
Lev
|
|
|
|
|
|
hi,
cmd.CommandType = CommandType.StoredProcedure;
string filldate = GridView2.Rows[e.RowIndex].Cells[2].Text;
string freedate = GridView2.Rows[e.RowIndex].Cells[3].Text;
cmd.Parameters.AddWithValue("@filleddate",filldate);
cmd.Parameters.AddWithValue("@freedate", freedate);
cmd.Parameters.AddWithValue("@nameofcustomer", GridView2.Rows[e.RowIndex].Cells[6].Text);
try
{
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
}
and stored procedure is:
Insert into PresidentialSuite(DateWhenFilled,DateWhenFree,NameOfCustomer)
values (@filleddate,@freedate,@nameofcustomer);
SET @filleddate = Convert(datetime,@filleddate);
SET @freedate = Convert(datetime,@freedate);
Iam not converting any nvarchar to datetime. why iam getting this error.
i tried number of ways of converting string to datetime in my C# code, but failed. so i used stored procedure.
thanks in advance
|
|
|
|
|
I suspect your date format is not what is expected by sql server, usually because one is using mm/dd/yyyy and the other is using dd/mm/yyyy.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi,
thanks for reply,
due to those reasons i left the conversion to sqlserver, i used the 'convert' in stored procedure.
bec i tried almost all ways of converting in my C# code
|
|
|
|
|
suni_dotnet wrote: i tried number of ways of converting string to datetime in my C# code, but failed.
You tried DateTime.Parse(...) and it failed? Obviously the input needs to be validated before even getting to your database.
only two letters away from being an asset
|
|
|
|
|
hi,
how can i validate. can use DateTime.TryParse(); ?
|
|
|
|
|
suni_dotnet wrote: how can i validate.
Maybe something like a validation control, regex, using a DateTime picker, using your brain would be the first step.
only two letters away from being an asset
|
|
|
|
|
hi
i tried alot before posting this question. searched google (1 week)... but couldnot find any solution..
i used my brain by all means but couldnot find solution.
iam a learner so does everyone. if everyone knows everything.. there wont be anything...
iam here to learn...
if possible plz guide me rather than ..
|
|
|
|
|
|
that i know,
its getting into argument..
can u help me with little coding. else no problem.
thank you
|
|
|
|
|
What help do you need?!? You have had multiple answers, its time for you to apply it.
only two letters away from being an asset
|
|
|
|
|
what format is the original date in?
and what format is the database storing dates?
it should be fairly simple to convert to required date in c#
not good to use stored procedure if original date and stored date formats are different cuz it cant handle the days and month being switched round i.e. dd/MM/yyyy and MM/dd/yyyy
|
|
|
|
|
i need to input values through gridview (cell),into db(sqlserver, datatype is datetime) i didnot specify any format, my code takes the text values and converts to datetime(stored procedure) and stores.
i tried:
Convert.ToDatetime
DateTime.Parse
using IFormatterProvider--Globilization...
|
|
|
|