|
Jammer wrote: Your going to get sick of me soon!
No, you're asking clear questions, posting code, and asking in the right place. I say bring it on !!!
Jammer wrote: public static object ScanDirectories(string scanEntryPoint)
Why are you returning object and not List<FileEntry> ?
Jammer wrote: SingleDirectoryFileStore.Add(new FileEntry(fileName, fileSize, fileExt, fileCreated));
I think I answered this once before. You're creating the list as a local variable. You need to either pass it into GetDirectoryFiles ( so it exists there, it will be passed by reference ), or you need to make it a member variable. You say you've tried to pass it in, why did that not work ? What error did you get ? As the method is static, adding it as a static member variable seems like it would be harmless, just clear it at the top of ScanDirectories. Then you could also cache the result, if the same scanEntryPoint is passed in a second time, you could pass back the result without scanning again, if that was appropriate ( this would mean adding a static string to store the last scanEntryPoint )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: No, you're asking clear questions, posting code, and asking in the right place. I say bring it on !!!
GREAT! I am trying to be as structured about this as possible as any ambiguity in questions can just add to the confusion ... something I really don't need at the moment!
Christian Graus wrote: Why are you returning object and not List<fileentry> ?
Noted ... I simply thought that as it was an object, the object keyword was the way to go with that ... I'll amend that in the code. I actually got this working just a moment ago by just adding to this line thus:
static void GetDirectoryFiles(List<FileEntry> SingleDirectoryFileStore, DirectoryInfo filesInDirectory)
I made the mistake originally by adding it again to this line:
foreach (DirectoryInfo dir in directorySubDirectory)
{
GetDirectoryFiles(SingleDirectoryFileStore, dir);
}
But of course ... its passing it back into the original code that is already aware of what SingleDirectoryFileStore is ...
I'm REALLY interested in the other point you make about storing the last scan directory and cacheing the results. Also how would I go about making the List<FileEntry> a member variable? I'm not even sure what a member variable is!
|
|
|
|
|
Jammer wrote: Noted ... I simply thought that as it was an object, the object keyword was the way to go with that
object has four methods = toString, GetHasCode, and two others that escape me. You will need to cast it back to the right object to use anything else. And, your code can now return anything, it's not at all clear what it returns. So, no, always strongly type stuff ( that is, make clear exactly what you're taking or returning ). Use object to say 'I will take anything and try to find a use for it'.
If I have a class, like this":
class MyClass
{
private int _myMemberInt;
public void Method()
{
int myLocalInt;
}
}
So, myLocalInt is only visible inside Method, but _myMemberInt is visible to any method in the class instance.
In your instance, it would be private static List etc ( that is, it would be static, so static methods can see it ). You'd call new on it in a static constructor, or inline ( that is, when you declare it ). Then when you call your method, you would call Clear to clear the old data.
Then, you can have a string property that stores the last search made. Now, if the search that comes in, is the same value, then your list already contains the result of that search, so you could just return that list, without doing the search again.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Brilliant! Its going to take me a while to ingest that but it sounds like the way forward.
One thing I'm noticing is that there are an awful lot of very badly written code examples out there in the wilds of the wibbly wobbly web. Some that purport to be 'a simple introduction to' are absolutely nothing of the sort. They assume you already know quite a lot about the ins and outs of the language.
You in particular have laid a few things out for me that are full of content and relative easy to grasp. Thanks for that!!
I'm having a few problems with my xamDataGrid binding to the List I'm generating now but I'm going to bang on with that for a moment, I have the WPF Unleashed book here that I hope will have some good things to say.
I was looking at your article on controlling the dimentions of grid panels the other day as I have to implement an accordian control over the next couple of weeks ... should be fun!
Best,
James.
|
|
|
|
|
Jammer wrote: One thing I'm noticing is that there are an awful lot of very badly written code examples out there in the wilds of the wibbly wobbly web.
Hell, yes. And some of the MSDN samples are right up there.
Jammer wrote: Thanks for that!!
*blush* glad to help
Jammer wrote: I have the WPF Unleashed book here that I hope will have some good things to say.
That is a good book.
Jammer wrote: I was looking at your article on controlling the dimentions of grid panels the other day as I have to implement an accordian control over the next couple of weeks ... should be fun!
The one with Nish ? We had a whole series planned, when time permits. Maybe soon....
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
I developing a security application that suppose to run before explorer.exe runs or perhaps before the start bar comes up and any other applications that the user may install...
So my question is how can I do it?
Maybe a registry value?
Thank you very much,
Yasa
|
|
|
|
|
I know the gina.dll is what handles the login. I suspect Explorer is the first thing that runs when a user has logged in.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: gina.dll is what handles the login
Huh... sounds like my wife.
|
|
|
|
|
|
I have a Windows Form ContextMenuStrip that I use with several controls on my form. The menu items themselves are instances of ToolStripMenuItem. I handle the Click event for each ToolStripMenuItem.
My problem is that inside the Click event, the sender is the ToolStripMenuItem, and I seemingly have no way of telling which control was originally right-clicked. I know which menu item was right-clicked, but I don't know the original control that was right-clicked.
I hate to create separate instances of ContextMenuStrip, since it is the same menu for all the controls I am working with.
How do I "pass-along" the a reference to the original control to the ToolStripMenuItem?
Thanks,
Mark
|
|
|
|
|
Use the SourceControl property of the ContextMenuStrip .
Eslam Afifi
|
|
|
|
|
I have a C# form that I want to act as a semi-transparent on-screen display. If the user clicks in my application I would like the message to be passed down to the window below it.
From Google, I've tried adding the GWL_EXSTYLE, WS_EXSTYLE and WS_EX_TRANSPARENT styles to the window with no luck.
I've also tried to override my WnnProc handler to return the MA_NOACTIVATE style to disregard the message and hopefully pass it on through:
<br />
protected override void WndProc(ref Message m)<br />
{<br />
if (m.Msg == WM_MOUSEACTIVATE)<br />
{<br />
m.Result = (IntPtr)MA_NOACTIVATE;<br />
}<br />
else <br />
base.WndProc(ref m);<br />
}
Neither worked. Does anybody have any suggestions on what to try?
Thanks,
Aaron
modified 12-Jul-20 21:01pm.
|
|
|
|
|
|
I didn't use the right terms appearently.
For those who are looking for a solution, override the CreateParams of the form:
<br />
protected override CreateParams CreateParams<br />
{<br />
get<br />
{<br />
CreateParams cp = base.CreateParams;<br />
cp.ExStyle |= WS_EX_TRANSPARENT;<br />
return cp;<br />
} <br />
}
modified 12-Jul-20 21:01pm.
|
|
|
|
|
iam working with listview on that listview, iam getting images. Now i need to enlarge that images how to do that please help urgent
|
|
|
|
|
Hi use this
<br />
this.listView1.View = System.Windows.Forms.View.LargeIcon <br />
<br />
Yogesh Agarwal
|
|
|
|
|
great subject.
urgent, did you say urgent? I'll put it at the bottom of my inbox then.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
bufff.... urgent....!!! i'll request oxford dictionary to remove this word
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
We know it's a C# question. This is the C# forum.
Next time, read the forum guidelines and give your posts more meaningful names.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
pmarfleet wrote: We know it's a C# question. This is the C# forum.
Can't guarantee that around here
only two letters away from being an asset
|
|
|
|
|
Nath wrote: please help urgent
Shame on you. That is considered rude around here...
|
|
|
|
|
Hi All,
I've been looking at this for a few hours now, tried a few things I've read on the web with not much luck and I'm a git lost, I've never done this before and I'm getting a bit confused by the examples I've read online to be honest. How do I implement IEnumerable<t> on this code:
class BuildGenericLists : IEnumerable<T>
{
public struct Filelist
{
public string file_name, file_size, file_ext, last_access;
public Filelist(string fileName, string fileSize, string fileExt, string lastAccess)
{
file_name = fileName;
file_size = fileSize;
file_ext = fileExt;
last_access = lastAccess;
}
}
public static object BuildMainFileList()
{
List<filelist> MainFileTableObject = new List<filelist>();
MainFileTableObject.Add(new Filelist(@"G:\Jammer1\", "2132987KB", ".WAV", "12/12/2001"));
MainFileTableObject.Add(new Filelist(@"G:\Jammer2\", "2132987KB", ".AIF", "12/12/2002"));
MainFileTableObject.Add(new Filelist(@"G:\Jammer3\", "2132987KB", ".PRG", "12/12/2003"));
MainFileTableObject.Add(new Filelist(@"G:\Jammer4\", "2132987KB", ".ASD", "12/12/2004"));
MainFileTableObject.Add(new Filelist(@"G:\Jammer5\", "2132987KB", ".WAV", "12/12/2005"));
MainFileTableObject.Add(new Filelist(@"G:\Jammer6\", "2132987KB", ".WAV", "12/12/2006"));
return MainFileTableObject;
}
}</filelist></filelist>
Should the
: IEnumerable<T>
actually be on the following line instead?
public static object BuildMainFileList();
Once this has been inherited how would the code for the GetEnumerator() / Current / Move Next be inserted into the code?
Sorry I know this is going back to basics for most of you but help a newbie The examples on the net all seem to differ and I can't work out what is needed and what isn't needed as there seems to be a difference between the generic implementation and other implementations.
TIA,
James.
|
|
|
|
|
List<Filelist> list = new List<Filelist>();
only two letters away from being an asset
|
|
|
|
|
Hi,
Damn, I'm still getting used to the posting code bit ...
My code is already contains:
List<Filelist> MainFileTableObject = new List<Filelist>();
I'm just struggling with where to put the GetEnumerator() code and the other features on the IEnumerable interface methods. I'm really stuck on this and have been going round in circles all day trying to get to grips with it.
Thanks,
|
|
|
|
|
Hi,
I've got this to compile now but how do I know if this is actually implementing IEnumerable?
class BuildGenericLists : IEnumerable
{
public struct Filelist
{
public string file_name, file_size, file_ext, last_access;
public Filelist(string fileName, string fileSize, string fileExt, string lastAccess)
{
file_name = fileName;
file_size = fileSize;
file_ext = fileExt;
last_access = lastAccess;
}
}
public static object BuildMainFileList()
{
List<Filelist> MainFileTableObject = new List<Filelist>();
return MainFileTableObject;
}
public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}
}
Using breakpoints I can't see the program ever hitting the return (IEnumerator)this; line. I'm feeling pretty dumb at the moment. I thought I was starting to get a grip of C# basics but I'm stumped on this at the moment.
|
|
|
|
|