|
The link Judah provided looks like a start. Like Christian said, shouldn't be any different. Just use what the framework offers and let the OS do the rest.
"That's no moon, it's a space station." - Obi-wan Kenobi
|
|
|
|
|
Is anybody now, how to get the date now from DateTime object or other data objects of C# class.
Thanks in advance.
|
|
|
|
|
|
Kevin I have tried this but it is not working in 2.0 in my visual express, is it working in yours?
|
|
|
|
|
With the advent of intellisence couldn't you have figured that one out for yourself?
It really depresses me the level of questions I see here. Does no one take the time to try and figure things out for themselves any more?
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
At least he didn't say it was urgent, need answer now
only two letters away from being an asset
|
|
|
|
|
There was a deadline tho, he wanted to know today's date...
|
|
|
|
|
That was the best thing I've read in months!
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
He was kind enough to add the valuable information "C#" to the subject line, so that we would know that it was actually a C# question that was posted in the C# forum.
He failed to ask us to send the replies to his e-mail address, though.
---
single minded; short sighted; long gone;
|
|
|
|
|
I'm just waiting for the Satips reply now.
only two letters away from being an asset
|
|
|
|
|
I think he's using Visual C# 6.0, where intellisense fails always.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
I am using Visual Web Developer 2005 express edition and maybe it is failing but it is not working in my intelisence
Thanks for reply
|
|
|
|
|
I am not sure why but in my intllisense that comes with Visual Studio Express there is nothing for date now. Most places including msdn showing
DateTime.Now should work, but it isn't working with .net 2.0. If it working in yours please let me know if you don't mind.
|
|
|
|
|
Aleksandr71 wrote: If it working in yours please let me know if you don't mind.
Yes, it works on mine.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
"07/08/2007".ToDateTime() :->
For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.(John 3:16)
|
|
|
|
|
Now.ToString();
This statement is false
|
|
|
|
|
Hello,
I wish to merge horizontally and/or vertically cells in a datagridview control, mostly in its header. Does anyone know how to do it?
Thanks
Programmer in trouble
|
|
|
|
|
You don't merge in the DataGridView control, merge the underlying datasource. i.e. DataTable.Merge(), or using the db query to merge results.
only two letters away from being an asset
|
|
|
|
|
Hi
Is it possible to to add Tag or data of some kind to a combobox item?
no the whole combobox a single Item inside .
Thanks
Have a nice Day
|
|
|
|
|
Hi,
ComboBox (and ListBox) collect items of any type you choose, not just string.
So you can create a special item class to hold whatever you want, and add
instances of that class to your ComboBox.
Now you should use ComboBox.DrawMode=OwnerDrawFixed and do the item painting
yourself using the ComboBox.DrawItem event.
|
|
|
|
|
Thanks i will try
is it too much to as a for a code sample...;)
Have a nice Day
|
|
|
|
|
Good news, you dont need OwnerDraw, it suffices to provide a ToString() method.
Example:
class cbi {
public int i;
public string text;
public cbi(int i, string text) { this.i=i; this.text=text; }
public override string ToString() { return text+" "+i; }
}
public Form1() {
InitializeComponent();
cb.Items.Add(new cbi(1, "a"));
cb.Items.Add(new cbi(2, "b"));
cb.Items.Add(new cbi(3, "c"));
cb.SelectedIndexChanged+=new EventHandler(cb_SelectedIndexChanged);
}
void log(string s) {Console.WriteLine(s);}
void cb_SelectedIndexChanged(object sender, EventArgs e) {
cbi item=(cbi)cb.SelectedItem;
if(item==null) log("item=null");
else log("item i="+item.i);
}
|
|
|
|
|
Doesn't a combo box have a display item and data item property ? Or is that just a combo box in a web page ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I cant find such property
only Item.
Have a nice Day
|
|
|
|
|
Hi, this is an example of the technique Christian refered to:
class cbi {
private int val; public int MyVal { get { return val; } }
private string name; public string MyName { get { return name; } }
public cbi(int i, string text) { this.val=i; this.name=text; }
}
public Form123() {
InitializeComponent();
ArrayList list=new ArrayList();
list.Add(new cbi(1, "a"));
list.Add(new cbi(2, "b"));
list.Add(new cbi(3, "c"));
cb.DataSource=list;
cb.DisplayMember="MyName";
cb.ValueMember="MyVal";
cb.SelectedIndexChanged+=new EventHandler(cb_SelectedIndexChanged);
}
void log(string s) {Console.WriteLine(s);}
void cb_SelectedIndexChanged(object sender, EventArgs e) {
cbi item=(cbi)cb.SelectedItem;
if(item==null) log("null");
else {
int i=(int)cb.SelectedValue;
log("i="+i);
}
}
It uses an ArrayList (or any other collection) as the source of all ComboBox data;
each item must now have two properties, one giving the text to display, one
giving the value to be returned by ComboBox.SelectedValue
|
|
|
|