|
Excellent explanation! Thanks Daniel.
|
|
|
|
|
but anyways... when I run it, it only displays the last file in the folder, according to alpabetical order... so if there are 3 folders: Alex Ben & Carly.... only the highest letter will show up... Carly...
it does this in every folder.... what's wrong?
here's my full code...
private void Page_Load(object sender, System.EventArgs e)
{
DirectoryInfo di = new DirectoryInfo("C:\\program files\\");
DirectoryInfo[] diArr = di.GetDirectories();
foreach (DirectoryInfo dri in diArr)
{
labelPath.Text=dri.Name;
}
}
/\ |_ E X E GG
|
|
|
|
|
It depends on what "labelPath" is. If it is simply a label you are repeatedly assigning it a version which overrights the previous one. Have you stepped through the code in the debugger? I would assume it is running the foreach three times (in your example of data), but you only pick up the last because it was the last assigned.
You could use a StringBuilder class and combine the names adding a line break to to each line. Depends on where the output is supposed to go.
Rocky Moore <><
|
|
|
|
|
eggie5 wrote:
labelPath.Text=dri.Name;
should be
labelPath.Text += dri.Name; , as Rocky pointed out you are just reassigning the name to the text each time through the loop. Instead you want to append the name to the text each time through the loop.
You may also want to add in some <br /> elements so that you get them on each line as you asked in your reply to me before (CP was giving me Error 500 fits )
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
I am searching for a .NET MIME encoder/decoder library. Please let me know if you know of one.
Thx
|
|
|
|
|
|
I am using SQLDMO to build a code generation application. When I find a column type in a given table, it usually comes back with the name 'int' for an integer, 'varchar' for a VarChar etc. The problem is that I need to do a translation from that sql type to the approrpriate SqlDbType in C# (e.g. SqlDbType.Int, SqlDbType.VarChar), so that I can output some source code that will build with no further modification. I, obviously, could just ignore the case difference and make the change manually to the generated code, but it seems there should be a way to avoid this.
Now, of course, I could create my own hashtable and hard code the mapped values (e.g. 'int' -> 'Int', 'varchar' -> 'VarChar', etc.), but it occured to me that this may already be in either the framework or the SQLDMO. Is anyone aware of a way to make this translation using a built-in mechanism? Or am I stuck creating a hard-coded map?
TIA.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
If all the values match, except for case then you could try using Enum.Parse() to get the correct enum value and then outputting the name into the code you are generating.
|
|
|
|
|
Very nice!! Thank you. That seems to work. I haven't tried all of the data types yet, but it looks pretty good.
Thanks again.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I'm fairly new to the C# environment but coming from Delphi, most of what we've been doing has been very familiar. Primarily, the difference has been syntax and a few new features we didn't have. An important technique we used a lot was the reusing of forms. This was done by creating a form, such as an address form, and reuse it in several areas. The exact same form would be used in the maintenance of people, shipping, billing, etc. while and underlying class property dictated the rules of the form.
Why do this? The flexibility and look of MDI was not nearly what we desired or needed. Instead, we created a form with panels in it. We then positioned the panels where we wanted them. We could then take a completed form (whose parent is SELF by default) and set the parent property to the panel. The second line of code set the form's alignment to client. This essentially pasted the form into the panel. This gave us the ability to have a developer build the central application while other tasks were divided by specialty. Now, if I were putting together something that needed the module that needed an address, I'd put a panel in the main application and just paste the address form into the panel at run time. I'd them use the class methods and procedures to move information appropriately.
What I'd like to do is perform this same type of task in C#. I've tried a few things but I'm not getting past the fact that a form is a "top level control". The impression I get is C# treats controls in a heirarchal form and a panel is lower than a form. Once the form is identified as such, I'm not allowed to put the form into a "lower" type control.
Are there any suggestions for doing something similar to this? This is quite a powerful technique that can be utilized even better in C# than in Delphi because of the ability to build multiple interfaces (shipping address maintenance, billing address maintenance, personal address maintenance, etc) and utilize them as the task requires.
|
|
|
|
|
make these "forms" as usercontrols instead.
|
|
|
|
|
An instance of MyClass is running in Thread A. This instance of MyClass instantiates an instance of YourClass.
As part of the constructor of YourClass a worker thread (Thread B) is started. When this worker is completed it calls a delegate callback function in MyClass.
In which thread context is the delegate function executed? Thread A or B?
|
|
|
|
|
I think that any function called from a delegate will normally be executed on a thread from the thread pool. Thus it will not be executed on Thread A or Thread B.
I have some memory of a way of getting a delegate to execute on a particular thread, but can't recall the details right now.
|
|
|
|
|
Hi all,
I've been trying to subscribe to SourceSafe events (BeforeCheckin, AfterCheckin etc.) through c# and interop. I've used tlbimp on SSAPI.dll to get access through c#.
In the Init() function I subscribe to events (BeginCommand += new ....) and the rest.
I change by ssaddin.ini file appropriately. When I open SourceSafe, my Init function gets called the way it should.
The only event handler that gets invoked consistently is the EndCommand handler. Depending on the order in which I subscribe to the events (+=), I can get different event handlers to be invoked but I can never get all of them invoked. (unexpected)
Looking at what tlbimp generates as a signature for the event handlers I came accross something strange. The BeforeAdd method (for example) expects as a first parameter a VSSItem, but if I implement the interface in Visual Basic 6, the signature for the same method expectes a IVSSItem.
Can anyone point me in the right directed to how I can get this working. I'm all out of ideas.
Thanks in advance.
|
|
|
|
|
Hi,
Please tell me about compile an project in C# for run under Windows 98, Win98 SE.
I try compile but it don't run, it's missing very library.
Thanks.
H.Dung
|
|
|
|
|
What errors do you get? Did you install the .net framework on the 98 machine? Did you install mdac 2.7 if you are doing db access?
|
|
|
|
|
Hi,
I don't compile C# run in Windows 98 because I install it in Windows 2000. Now I want compile C# project for run in Win98.
Please help me.
Thanks.
|
|
|
|
|
There is nothing different to do. Just install the framework on the 98 machine and then your app. As long as you don't use framework objects that are only supported on 2K you are fine.
|
|
|
|
|
Thanks for your suggest very much.
Now I can run my app in win98.
H.Dung
|
|
|
|
|
Hi,
I write an application in C# but I don't want user run it more one instance. How do I know numeric of instance of this app when user fire it? And how to I resolve this problem?
Please help me.
Thanks.
H.Dung
|
|
|
|
|
|
Hi,
Thanks you very much.
H.Dung
|
|
|
|
|
Hello, I'm making HTTP requests with System.Net.HTTPWebRequest and I want to capture the entire header of the request as a string. I'm able to do this with responses but now the requests. Am I missing it in the API somewhere or is there another way?
thank you
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Hi,
I'm creating a COM+ Client/Server in C# and so far things are going relatively well. The client talks to the server, the server puts the data sent to it into the database, it then sends a successful message back to the client. It all runs under the Component Services until start looking at calling the server from a remote machine. If I move the client to a remote machine I get a wonderful 'System.IO.FileNotFoundException' error referring to the server DLL. Surely I don't need to distribute the DLL along with the Client EXE file? Do I?
All I want to do is have a COM+ service running on a server and my client to connect to it! Could some one help me figure out what I missed?
Thanks in advance.
Graham
|
|
|
|
|
SpudgunDoogal wrote:
All I want to do is have a COM+ service running on a server and my client to connect to it! Could some one help me figure out what I missed?
I know that it is an obvious question, but have you exported a COM+ application proxy to the client computer?
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|