|
Change FirstFullWeek to FirstDay and you would get one. There is nothing like 53 week, AFAIK, so won't get that.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Thanks d@ninsh,
I think we can get that. Outlook calender displays that and that is what the help says for FirstFullWeek. If you use FirstFourDayWeek then it gives week 53 but i don't want to use because it will fail for me if new year week starts before wednesday.
|
|
|
|
|
If all you need to know is that first day is Monday or not, why not just check the DayOfWeek property for firstOfYear?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Thanks D@nish,
I am not trying to know about monday as first day. I am trying to extract the week num of first week where first day of week for me is Monday.
So, If the year (e.g. 2010) starts on Friday then Friday, Saturday & Sunday should be considered as days of last week of previous year and that is 53 for year 2009.I want this number(53).
Week number 1 should start from 4 Jan 2010 (Monday).
|
|
|
|
|
Oh. Once you get the day one first day of the month, you need to add/reduce the days to get to the first week accordingly. The tip posted in other reply would do that for you.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Week 1 of 2009 started on Monday, January 5th. This means that December 31st 2009, which fell on Thursday, was week 52. Thus Friday January 1st 2010 was also week 52; weeks start on Mondays, not Fridays - or any other days. (EDIT: I rush to add that weeks DO of course start on other days in many systems, but they did not in this case! Just in an attempt to preempt those who may already be writing to point out my cultural insensitivity.)
Thus you may *want* 53, but 52 is correct for 2010. The next time Jan 1st is in Week #53 is in 2013 (the last was in 2008).
modified on Friday, January 8, 2010 7:27 AM
|
|
|
|
|
d@nish wrote: There is nothing like 53 week, AFAIK, so won't get t
Oh yes there is! Week one of any year is the first week containing a Thursday in the new year. This means that Jan the first can be in week one, or in the last week of the previous year, which (depending on when Jan 1st was for that year) can be week 51, 52, or 53. There is an international standard for week of the year: ISO-8601[^]
[edit]Typos due to typing with gloves on - it's cold in here![/edit]
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Yes, but since weeks have 7 days and 52*7 = 364 and a (leap) year has 365 (366) days, this means the first day of the year can be week 1, week 52, or week 53. For example, if a year starts on a Friday, there are only three days belonging to that week in the new year. Thus week 1 might start on the fourth day of the year, in which case we'd still not be finished with week 52 on December 31st. The only times you get to week 53 is thus - if the week start on Monday - when a year starts on Monday, or on a Tuesday AND it is a leap year.
For example, in a non-leap year that starts on Monday after 364 days or 52 full weeks it'll be Monday again but with one day to go; this will be Monday December 31st of whatever year it is, and the first day of week 53. The next day would then be January 1st, and since it's a Tuesday it clearly belongs to the same week as the Monday, since your weeks (as do mine) start on Monday.
|
|
|
|
|
|
Thanks Rich.
Actually, I wanted to display week num for starting days before monday of new year.
|
|
|
|
|
gajesh wrote: Actually, I wanted to display week num for starting days before monday of new year.
OK, that requires a little bit of mathematics - using my sample week 1 of 2009 starts on Monday, December 29, 2008, so add 52 * 7 (364) and we get December 28 2009, which is beginning of week 53, since we know that week 1 of 2010 begins on 4th January.
|
|
|
|
|
Thanks.
Yeah.. I'll do this calulation.
Thanks again.
|
|
|
|
|
If week one started December 29, 2009, I sure as heck wonder what week number you assign to the *previous* Monday, December 22, 2009.
In fact, there was a week 53 in 2008, so week 1 in 2009 didn't get started until Monday January 5th. Thus the last day of 2009 was still in Week 52 and so were the first few days of 2010. Week 52 is therefore correct, and the original question was flawed. Not that this isn't understandable - it's very easy to put a foot wrong on these things. The complexity is quite moderate, but very subtle!
(EDIT: By the way, I am fully aware that December 22, like December 29, did not fall on a Monday in 2009. The point is, and it's funny imo, there's been a rather humerously long week 53 or some unprecedented new all-time-high in week number if week one didn't get started until late December.)
|
|
|
|
|
I think you have got a bit confused, try re-reading my explanation.
|
|
|
|
|
Couldn't think of a decent subject. sorry.
If I add a DataGridView to a Form in constructor and create and set its datasource there itself. Now, I also check the rowcount in the constructor and it comes out as zero. Can someone explain the reason?
Here[^] is the question that triggered mine.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
I believe this is because the RowCount property is related to the rows visually represented by the DataGridView control. According to your steps, after the constructor has run you have a DataGridView control and a DataSource attached to it that is filled with data, but the DataGridView control hasn't done it's visual rendering yet. If you check the property after the DataGridView has been rendered and displayed at least one time, you should get the expected value. Try placing an event handler on the Form.Shown event and then put a break point in the handler and check the RowCount property.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
|
|
|
|
|
That is what I had in mind as well. Let us see if we get a confirmation.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hey Guys,
Can any one tell how can we make use of form in windows application for creating object explorer , query analyzer and registered services windows of sql server management studio ? And it should also have the same kind of functionality what we get in sql server management studio.
Thanks,
Vikas
vikas da
|
|
|
|
|
How do I select distinct rows from a DataTable?
|
|
|
|
|
fill it distinct !!!!
|
|
|
|
|
By "DataTable", do you mean a table in a database?
In my opinion, there should be no identical rows (rows with identical values for ALL fields) in a database table. So please clarify your question a bit. Thanks!
|
|
|
|
|
By definition no real database (as opposed to using excel or similar as a datasource) will allow two identical records in all fields: The primary key must be unique. It is perfectly possible (but very annoying) to have all other fields identical between two or more records, though. Software should cope with it (as well as try to prevent it), because people will make mistakes...
I think the OP is talking about using a DataTable object, though.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Assuming that you want to select specific rows from a DataTable object rather than a database table, you can use the DataTable.Select method[^]
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
hello every1,
M new to this site so dont know how to post a query here if m wrong do correct me.M making a project in Csharp.Net on batch image processing.I can display multiple images n select it in check box but instead of checkboxes i want the thumbnail of the images to be displayed in the box.Can somebody please help.Thanks in advance......Here is the code that i coded in MS Visual Csharp 2008 express edition
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Dictionary<string, string> ImageList = new Dictionary<string, string>();
public Form1()
{
InitializeComponent();
SetStyle(ControlStyles.ResizeRedraw, true);
}
private void button3_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
DirectoryInfo FileDirectory = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
FileInfo[] FileJpg = FileDirectory.GetFiles("*.jpg");
FileInfo[] FileGif = FileDirectory.GetFiles("*.gif");
FileInfo[] FileBmp = FileDirectory.GetFiles("*.bmp");
FileInfo[] FileTif = FileDirectory.GetFiles("*.tif");
FileInfo[] FilePng = FileDirectory.GetFiles("*.png");
foreach (FileInfo File in FileJpg)
{
ImageList.Add(File.Name, File.FullName);
checkedListBox1.Items.Add(File.Name);
}
foreach (FileInfo File in FileGif)
{
ImageList.Add(File.Name, File.FullName);
checkedListBox1.Items.Add(File.Name);
}
foreach (FileInfo File in FileGif)
{
ImageList.Add(File.Name, File.FullName);
checkedListBox1.Items.Add(File.Name);
}
foreach (FileInfo File in FileTif)
{
ImageList.Add(File.Name, File.FullName);
checkedListBox1.Items.Add(File.Name);
}
foreach (FileInfo File in FilePng)
{
ImageList.Add(File.Name, File.FullName);
checkedListBox1.Items.Add(File.Name);
}
}
}
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
pictureBox1.ImageLocation = null;
String s = folderBrowserDialog1.SelectedPath.ToString() + checkedListBox1.SelectedItem.ToString();
MessageBox.Show(s.ToString());
pictureBox1.ImageLocation = s;
}
private void Form1_Load(object sender, EventArgs e)
{
checkedListBox1.CheckOnClick = true;
}
private void checkedListBox1_SelectedIndexChanged_1(object sender, EventArgs e)
{
pictureBox1.Image = Image.FromFile(Path.Combine(folderBrowserDialog1.SelectedPath, checkedListBox1.Items[checkedListBox1.SelectedIndex].ToString()));
}
private void label2_Click(object sender, EventArgs e)
{
}
}
modified on Thursday, January 7, 2010 9:17 AM
|
|
|
|
|
Please edit your post and surround the code in the '
' tags, this will format it so it will appear to others just as you normally see it in Visual Studio. You can put the tags around the text yourself or highlight the text and then click the 'code block' option above the edit window.
Also, what control are you using for displaying the images?
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
|
|
|
|
|