|
You bet. Yes it can, you can do something like this:
DateTime DateT = new DateTime(1, 3, 3);<br />
MessageBox.Show(DateT.Day.ToString());
And that will display the Day of the week of any date you specify
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks,
I have a datetime column on my table( ADEDATE type datetime)
Select id, ADEDATE from Table ,I would like to get the day of the week for the result of the selecet statement.
the result of the select statement will be similar to ..
12,Monday
13,sunday
14,saturday
Which function shall i use for this task?
Thanks
|
|
|
|
|
Well, you should parse the Year, Month, and Date from the field, drop them into variables and then drop them into your DateTime object, and then return the Day of the week. Does this answer your question?
DateTime DateT = new DateTime(Year, Month, Date);
MessageBox.Show(DateT.Day.ToString());
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks very much,
Well i have to use stored procudure in Sql script.All i want is how my select statement can get the days of the week for my Datecoulmn on my table?
May be i should post it Sql forum?
Did you get me now?
Thanks
|
|
|
|
|
Oh yes, I get you now. You are trying to do all this in a stored procedure. Yeah, you should ask in the SQL forum.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Use one of the many formatting options available in the DateTime object.
MessageBox.Show(DateTime.Now.ToString("d"));
MessageBox.Show(DateTime.Now.ToString("dd"));
MessageBox.Show(DateTime.Now.ToString("ddd"));
MessageBox.Show(DateTime.Now.ToString("dddd"));
|
|
|
|
|
Hello!
Little problem. I want to get non-english chars from e-mail, but can't! For example:
From: "=?KOI8-R?B?49fJIOfJ0ts=?=" must resolve as From: "Цви Гирш"
Thanks!
|
|
|
|
|
hi
it's a mime encoded line:
=?KOI8-R?B?49fJIOfJ0ts=?= means:
KOI8-R is the ascii encoding
B is the encoding method
B = Base64
Q = Quoted printable
and 49fJIOfJ0ts= is the content
to get Цви Гирш from "=?KOI8-R?B?49fJIOfJ0ts=?=" you do the following:
string s = "=?KOI8-R?B?49fJIOfJ0ts=?=";
string[] frg = s.Substring(2,s.Length-4).Split('?');
if (frg.Length == 3)
{
string encoding = frg[0];
string method = frg[1];
string content = frg[2];
switch (method.ToUpper())
{
case "B":
{
System.Text.Encoding enc = System.Text.Encoding.GetEncoding(encoding);
byte[] val = Convert.FromBase64String(content);
string text = enc.GetString(val);
System.Windows.Forms.MessageBox.Show(text);
break;
}
case "Q":
{
break;
}
}
}
hope this helps
M@u
|
|
|
|
|
cool.. u got 5 from me..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Thanks!!!!!!!!!!!!!!!!!!!!!
thank you so much!!!
|
|
|
|
|
Hi All
I am using PropertyGrid to show the properties of object..
want to use property grid with combo box and taking help from this MSDN link..
http://msdn2.microsoft.com/en-us/library/aa302326.aspx
here is the code that I am using..
<br />
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.ComponentModel;<br />
<br />
namespace PropertyGridTest<br />
{<br />
[DefaultPropertyAttribute("Person")]<br />
class Person : StringConverter<br />
{<br />
public Person(string inName, string inAddress, int inAge, bool inEmployed)<br />
{<br />
name = inName ;<br />
address = inAddress ;<br />
age = inAge ;<br />
employed = inEmployed;<br />
}<br />
<br />
<br />
public Person(string inName)<br />
{<br />
name = inName;<br />
}<br />
<br />
<br />
private string name;<br />
private string address;<br />
private int age;<br />
private bool employed;<br />
<br />
<br />
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)<br />
{<br />
return true;<br />
}<br />
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)<br />
{<br />
return true;<br />
}<br />
<br />
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)<br />
{<br />
return new StandardValuesCollection(new string [] {"AAA", "BBB", "CCC", "DDD" });<br />
<br />
}<br />
<br />
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)<br />
{<br />
return false;<br />
}<br />
<br />
<br />
<br />
[TypeConverter(typeof(Person)), <br />
CategoryAttribute("Person Details"), DescriptionAttribute("Name of the Person")]<br />
public string Name<br />
{<br />
get<br />
{<br />
return name;<br />
}<br />
set<br />
{<br />
name = value;<br />
}<br />
}<br />
<br />
[CategoryAttribute("Person Details"), DescriptionAttribute("Address of the Person")]<br />
public string Address<br />
{<br />
get<br />
{<br />
return address;<br />
}<br />
set<br />
{<br />
address = value;<br />
}<br />
}<br />
<br />
[CategoryAttribute("Person Details"), DescriptionAttribute("Employed")]<br />
public bool IsEmployed<br />
{<br />
get<br />
{<br />
return employed;<br />
}<br />
set<br />
{<br />
employed = value;<br />
}<br />
}<br />
<br />
<br />
[CategoryAttribute("Person Details"),<br />
DescriptionAttribute("Age of the Person")]<br />
public int Age<br />
{<br />
get<br />
{<br />
return age;<br />
}<br />
set<br />
{<br />
age = value;<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
and
<br />
<br />
private void radioButton1_CheckedChanged(object sender, EventArgs e)<br />
{<br />
if (radioButton1.Checked)<br />
{<br />
try<br />
{<br />
Person person = new Person("John", "CA", 5, false);<br />
propertyGrid1.SelectedObject = person;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
Now when i run the application then a exception is caught and the message is "Constructor on type PropertyGridTest.Person not found" is popped up,
also "Name" property is disabled.
Please help me to solve this problem..
that is how to show combobox in propertyGrid.
Please help me.
Thanks & Regards
|
|
|
|
|
rajeevktripathi wrote: Person : StringConverter
Your class should not derive from a TypeConverter, rather use the TypeConverter attribute to decorate the 'Person' class.
|
|
|
|
|
HI Thanks for your reply...
Please tell me that how to decorate Person class from TypeConverter attribute
but in the MSDN link learened that I have to derive my class from the TypeConverter ...
So PLease help me in resolving the problem...
Thanks & Regards
|
|
|
|
|
I have a very basic question.
If I declare some variables in my class and just run my C#.Net program, without any work done in it, will it allocate a memory for these variables?
For Example,
Class abc
{
public int a;
public double b;
}
Regards,
Anil
|
|
|
|
|
yes - when an instance of the class is created
|
|
|
|
|
Does that mean, when we include say System.Data.SQLClient namespace on the top of our class, it copies all the classes inside this namespace at runtime and allocates memory accordingly even if we don't use anything in it?
Regards,
Anil
|
|
|
|
|
no not when including the namespaces/classes, when instantiating them
|
|
|
|
|
A M SOMAN wrote: Does that mean, when we include say System.Data.SQLClient namespace on the top of our class, it copies all the classes inside this namespace at runtime and allocates memory accordingly
It will allocate memory once you create instance for it. class1 c1; won't allocate any memory. But class1 c1 = new class1() will allocate memory space.
|
|
|
|
|
|
Yes, it is possible. Use System.Runtime.Remoting
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
But How. Is there any codding sample for this type of Idea???
Naresh Patel
|
|
|
|
|
Yeah, there is more code samples than you can shake a stick at. Google it, C# remoting.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
|
I have ListView and i need to know the item that seleceted in event - how to do it ?
|
|
|
|
|
lv.SelectedItems();
or
lv.SelectedIndices();
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|