|
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?
|
|
|
|
|
i didnt get u @Ben what control means?????
|
|
|
|
|
Use <pre> tags to surround code blocks.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I believe you mean <pre>code here<pre/> tags. 
|
|
|
|
|
I think you should restate your question as it's not terribly clear. You want to provide a way to select multiple images for batch processing, and you want to display thumbnails, but it all stops there for me. What are you having difficulty with? Drawing images to the screen? If so, have a look at the Graphics class.
|
|
|
|
|
till now i have put a checkbox and i can select multiple images through it n it is displayed in the preview box but instead of seeing just the name of the images in the checklist box i want the thumbnails of the images to be displayed along with the check button
|
|
|
|
|
It seems that you want to use a CheckedListBox and display thumbs instead of filenames. To do so I believe you must use the OwnerDraw method. Try googling it though - surely many have done the same or something similar before you.
|
|
|
|
|
|
If i click on add photos a new window pops to select a particular folder in whcih images are present.But i cannot select the particular image i have to select the whole folder and the names of these images are then displayed in the checklist box.I want the thumbnails of these images to be displayed in this box.When i will select a particular image it will be displayed in the preview box,There is also a problem here i cannot c the whole image but only a part of it.......I hope this will help u to clear my doubt.
|
|
|
|
|
Hi,
one way to get what you want is this:
1. define a little MyImage class, containing a file name, a bitmap, a selected flag.
2. use a regular ListBox; it can show a collection of items of any type you choose (not just strings), so use it to hold instances of MyImage.
3. provide your own DrawItem handler to paint the MyImage any way you like (use Graphics.DrawString to show the file name, and DrawImage to draw a thumbnail)
4. add click and doubleclick handlers as you see fit.
As an example, this little article[^] uses an owerdrawn ListBox in order to get colored text lines.
|
|
|
|
|
djsproject wrote:
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);
}
This is WTF. Use at least the following solution please:
string[] extensions = new string[] {"jpg", "gif", "bmp", };
foreach (string extension in extensions)
{
FileInfo[] FileJpg = FileDirectory.GetFiles(string.Format("*.{0}", extension));
foreach (FileInfo File in FileJpg)
{
ImageList.Add(File.Name, File.FullName);
checkedListBox1.Items.Add(File.Name);
}
}
Also, set meaningful names for your controls, please. e.g. change 'button1' to 'buttonAddImage' or sth.
Greetings - Jacek
|
|
|
|