|
you want only clueless and stupid questions then?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
erfgerfgerger wrote: Dont spam the forum with answers that are helpless and stupid
So I can spam with stuoid questions then, just not answers you don't like.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
If you read the comments in the snippet you posted, and then search based on the keywords there, you will find your answer
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) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
|
Well, that page explains the difference just fine.
With static constructor (=without beforefieldinit): the singleton instance is created exactly when the class is used for the first time.
No static constructor (=with beforefieldinit): the .NET runtime gets more freedom - it may initialize the singleton at any time before it's used, maybe even directly at the start of the program before "void Main()" gets to run.
|
|
|
|
|
|
The article links to an explanation, read it.
|
|
|
|
|
Hi,
Previously from the SCROLL EVENT I checked with the condition like;
bool scrollLeft = false ;
MINVALUE = 0;
MAXVALUE =10;
private void hScrollBar1_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e)
{
scrollLeft = e.Type.ToString ().ToLower () == "largeincrement" ? false : true;
}
private void hScrollBar1_ValueChanged(object sender, System.EventArgs e)
{
MINVALUE = scrollLeft == false ? MINVALUE + 10 : MINVALUE - 10;
MAXVALUE = scrollLeft == false ? MAXVALUE + 10 : MAXVALUE - 10;
}
And in the Paint function I am doing all the logics...
Suppose for <---------------------------------> Horizontal scroll bar if we click extreme right end > then the value should change.. In the value change event i am checking with the scrollLeft variable. it will move always forward not backward...
I am having the panel and plotting graph in the panel and below i am placing horizontal scroll bar...
How todo by clicking the right end of scrollbar any event?
Reg,
Subbu
|
|
|
|
|
Hi,
Right now you are trying to design your program's logic but you don't really know how a scroll bar works. In this situation I would create a small project with one purpose, which would be to display the events from a scroll bar. The knowledge gained from the test project can then then be applied to your main project to help you with your design.
A simple test project would have a main form containing
1) a horizontal scroll bar
2) a multiline textbox.
Create handlers for the scrollbar's Scroll and ValueChanged events, e.g.
private void hScrollBar1_Scroll(object sender, ScrollEventArgs e) {
this.textBox1.AppendText(String.Format("Scroll Event {0} {1} {2} {3}" + Environment.NewLine,
e.ScrollOrientation, e.Type, e.OldValue, e.NewValue));
}
private void hScrollBar1_ValueChanged(object sender, EventArgs e) {
this.textBox1.AppendText(String.Format("ValueChanged Event {0}" + Environment.NewLine,
this.hScrollBar1.Value));
}
What you have now is a test system which displays event information in the text box whenever you move the scrollbox.
This will teach you a lot about scroll bars and will enable you to figure out what you need to do to in your main app. You will probably be suprised to see how many events a scroll bar generates!
Alan.
|
|
|
|
|
Thanks for your valuable points..
|
|
|
|
|
Hello Everyone
I need someone who can help me.I want to check the oldest file in the directory, and if that file is older than one hour then send an alert.
Here is my current work.
for (int index = 0; index < files.Length; index++)
{
string lastMTime = File.GetLastAccessTime(files[index]).ToString("ddMMyyymmss");
files[index] = lastMTime + files[index];
}
Array.Sort(files);
string oldFile = Path.GetFileName(files[0].Substring(15));
if(File.GetCreationTime(oldFile))
<br />
<br />
if(File.GetCreationTime(oldFile))
Please my code project peeps, help me out....
Thank you all in Advance
Marvel...
|
|
|
|
|
TimeSpan ts = DateTime.Now.Subtract(File.GetCreationTime(oldFile));
if (ts.TotalHours >= 1) ...
This should do the trick.
Note that you are calling GetLastAccessTime() for sorting and GetCreationTime() for checking the file age, I'm not sure this is what you want.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
For date and time handling you must use the builtin DateTime type, it gives you all the methods you need.
You can get the current time with DateTime.Now , and you can compare two date times or subtract one to another to obtain a TimeSpan value representing the difference between the two (Moreno Airoldi sowed you how to do this).
Also, you don't need all the string parsing you are doing, just use a SortedDictionary with last access time for key and file path for value.
modified on Thursday, July 30, 2009 6:21 AM
|
|
|
|
|
Hi,
two comments:
1.
File.GetLastAccessTime does not really work on most systems. By default Windows does not track file access as that may create a heavy load on the file system; you can enable it through the registry somehow but I would not recommend that.
2.
IMO LastModificationTime is much more useful than CreationTime, since LastModificationTime is about the file content, whereas CreationTime is about the empty file. So when I now copy an old fle, it normally keeps its LastModificationTime but it gets its CreationTime set to now.
BTW: The above could be different for each and every file system (NTFS, FAT, FAT32, ...)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi.
How to run C# program in network pc without install dotnet??
i Install .netframework in network pc.
|
|
|
|
|
Don't use the .Net framework in your application and you don't need to install it. If you use it, you need to install it - simples
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
how can i run without using DotNet??
|
|
|
|
|
You can't.
Either you make the program in another language or you install .Net framework.
C# needs the framework and will not work without it.
|
|
|
|
|
|
I think Musefan is referring to Native Code? Like ah... Win32? Or I could be wrong
Regards,
Jason Pezzimenti.
If you liked the answer that I have provided, then please click the 'Good Answer' link on the bottom-right of this post. Thank you.
|
|
|
|
|
You say
mjawadkhatri wrote: i Install .netframework in network pc.
If you have installed the .NET Framework, what on earth is the dotnet that you refer to?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi everyone,
Any idea how would you show a nested table with the (+) sign in a DataGridView control to represent a one-to-many relationship in one table??
You know, something like
------------------------------------
Customer_ID Customer_Name
------------------------------------
(-) | 1 Customer1
| 1 Item1
| 2 Item2
| 3 Item3
-------------------------------------
(+) | 2 Customer2
-------------------------------------
(+) | 3 Customer3
--------------------------------------
Thank you!
|
|
|
|
|
As I'm sure that you are aware there are plenty of examples of this for ASP. I have never seen one for DataGridView on WindowsForms though.
Although you might want to look at the DataGrid from the pre .net 2.0 days, which has similar functionality. It is still there in System.Windows.Forms for compatibility and I believe you can add it to your Toolbox, if you really must. I have to say though, that it looks really clunky.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
True and true,
I've seen plenty of it in ASP, and I had a feeling and tried DataGrid ver 2.00 but it gives you a stupid link to replace the current table instead of branching to a sub table
|
|
|
|