|
I ran a quick test and this seemed to work for me.
string path = "c:\\documents and settings\\administrator\\";
bool exists = System.IO.Directory.Exists(path);
MessageBox.Show("This path is a directory: " + exists.ToString());
Using the same code above, but adding a file name to the path variable:
string path = "c:\\documents and settings\\administrator\\somefile.txt";
bool exists = System.IO.Directory.Exists(path);
MessageBox.Show("This path is a directory: " + exists.ToString());
So if you have a string that you are certain contains either a full file name or a directory path, you should be able to determine if it is a directory or not using System.IO.Directory.Exists(path);
|
|
|
|
|
But that won't work on a remote FTP site...
|
|
|
|
|
My mistake, the way you worded it sounded like they had been downloaded already.
|
|
|
|
|
Ohh sorry
When pulling the .ListDirectory I was wondering how to basically seperate the directories from the files.
Thanks for the response though.
|
|
|
|
|
That's a tough one - the FTP protocol isn't very robust.
Jacob Dixon wrote: just seeing if it has an extension at the end
What about files with no extension?
The FTP list commands only give a human readable listing...
Plus AFAIK there's no standard for what should be in the listing.
FWIW, here's an example of parsing a DOS style FTP list:
Here's an example[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the answer.. although I wish it wasnt that one lol.
So when creating FTP applications I guess most people do them in a different languages. I've been learning C# for a little while now and since started have always used this forum. Very brilliant people on here. I've improved quite a bit, but I am now getting interested in networking with it. I was wanting to create a FTP app and then try a chat app. Maybe I'll just stick with a simple FTP app lol.
Thanks
|
|
|
|
|
It's not the language. C# is just as effective as any other language for FTP.
The problem is the FTP protocol[^], which is a public published "standard".
It's dated and just doesn't provide a more robust directory listing command.
I'd like to see how FireFox does it...FTP directory tree always looks pretty
good there to me
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have created a dynamic crystal report "Generator" where u select the fields you want to see and than generate the report.
the problem im having is when i run the project.. it asks for a servername, database name, userid and password. ive set these in my code like this:
private ConnectionInfo crConnectionInfo = new ConnectionInfo ();
crConnectionInfo.DatabaseName = "DatabaseName";
crConnectionInfo.UserID = "Your UserID";
crConnectionInfo.Password = "Your Password";
the code i found says i must have a for loop where i loop through all the tables and apply the connection to the tables but i use a dataset so i dont know if this will apply.
Can sum1 please help me fix this error..
|
|
|
|
|
Hi everyone,
In some reasons I have an array of labels and its length is 3000!
I fix those Sizes and Locations and add them into a panel (in my form's constructor) but It takes about 10 or 15 seconds to load. Is there any faster way to do this task?
T.I.A
|
|
|
|
|
I believe that the correct forum for this could be Windows Forms!
I advice you to look for some kind of alternative for UI design since having thousands of labels in one panel is going to cause you a real headache.
Could you use grid instead?
The need to optimize rises from a bad design
|
|
|
|
|
Hi,
I'd be searching for a different approach.
I can't think of any problem that would require 3000 labels.
Mark.
Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
Click here to view my blog
|
|
|
|
|
Stress-test?
The need to optimize rises from a bad design
|
|
|
|
|
OK, let me explain:
These labels act like pixels in our monitors! A label means a pixel.
By this way I can write, draw and do many more tasks without any problem or limitations. For example if you want to write a text that contains both English and Persian alphabetic, you can touch a real headache! and I don't want my users have to go to a hospital at all!
If there's another way to solve this problem I will be glad to meet him/her!
|
|
|
|
|
"سلام" ("سلام" is a Persian greetings.)
If you try to highlight this text you can understand me.
modified on Tuesday, September 23, 2008 6:37 PM
|
|
|
|
|
You're trying to create a character-based interface using a label for each character position? In Windows?
I don't think there's any way to do that with proportional font, which I assume you'll need for Persian.
I hope I completely misunderstood your intent.
|
|
|
|
|
Okay,
Since you have already created a working coordinate system, I think you could simply use real drawing instead of labels. This way you could have for example an array of locations where pixel is set on/off. Forms simply won't handle that many lables nicely.
Have look at: System.Drawing Namespace[^]
The need to optimize rises from a bad design
|
|
|
|
|
|
While I think the way you are approaching this is probably not the correct way to do it, perhaps the following will help you.
public MyForm(Label[] tooManyLabels)
{
myPanel.SuspendLayout();
myPanel.ResumeLayout();
}
|
|
|
|
|
I am using csharp to create a user control for creating bar graphs,
The user control will use rectangles as bars, (drawn using gdi+).
I am adding this user control to a form, Now when i focus each bar in the user control instance on the form , it should raise a mouse hover event.
I am unable to identify when the mouse is over the rectangle. I do not want to calculate the position of mouse and then check what is drawn at what pixel and then raise the event.
I want some ideas on how to identify each bar or rectangle individually from the main form. Is it possible or I am just imagining ?
Hope you guys understand my problem ?
|
|
|
|
|
You can store all your bars as an array of Rectangle s or encapsulate them inside a bar class, like that:
class Bar
{
public Color Color;
public Rectangle Extends
public string Name;
}
You can then loop around all bars and check whether Rectangle.Contains(cursorPoint) .
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi all,
first ,m sorry 4 my bad English
how can i create appointments in ms outlook calender using asp.net
i did it under windows application but i don't think i can put it on a server , the problem is that i will prompt the user to give me there windows account name and password and some how i have to send the appointments that they did on the site to there own account of outlook ,
thinking of how can i do this make me want to cry
so if can i get some help it would be wonderful
|
|
|
|
|
How can I work with Date/Time field of Access Database in C#?
I need to read these feilds of a row and show it in messagebox. Also I need to add new rows to a table in access and fill these fields for it.
Sourie
|
|
|
|
|
A connection string for you is:
Data Source=the complete file path\somefile.mdb;Persist Security Info=False;
Use connectionstrings.com for more.
As for the rest a simple introduction into the world of ADO.NET will get you started. There are plenty of articles on CP that deal with that.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
Not sure if your question was about this, but if you're having a problem with date literals, as I recall, it uses format #mm/dd/yyyy#. For example #09/23/2008#.
The need to optimize rises from a bad design
|
|
|
|
|
thanks for your reply.
I need to have to seperate fields : Date and Time, but when I want to define columns in Access, I only see a field : Date/Time.
I do not know how to write from/read into this field in a c# program.
(I want to read time and date from two different textBoxs and save them in related field in a Access table. and also I want to read Date and Time field from access and show them in a MessageBox.)
Sourie
|
|
|
|