Click here to Skip to main content
15,892,161 members
Home / Discussions / C#
   

C#

 
GeneralRe: Csharp .Net doubt Pin
dojohansen7-Jan-10 3:08
dojohansen7-Jan-10 3:08 
AnswerRe: Csharp .Net doubt Pin
dojohansen7-Jan-10 3:12
dojohansen7-Jan-10 3:12 
GeneralRe: Csharp .Net doubt Pin
djsproject7-Jan-10 3:18
djsproject7-Jan-10 3:18 
GeneralRe: Csharp .Net doubt Pin
dojohansen7-Jan-10 3:39
dojohansen7-Jan-10 3:39 
General[Message Deleted] Pin
djsproject7-Jan-10 3:26
djsproject7-Jan-10 3:26 
GeneralRe: Csharp .Net doubt Pin
djsproject7-Jan-10 3:37
djsproject7-Jan-10 3:37 
AnswerRe: Csharp .Net doubt Pin
Luc Pattyn7-Jan-10 3:39
sitebuilderLuc Pattyn7-Jan-10 3:39 
AnswerRe: Csharp .Net doubt Pin
Lutosław7-Jan-10 12:28
Lutosław7-Jan-10 12:28 
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

GeneralRe: Csharp .Net doubt Pin
djsproject12-Jan-10 17:28
djsproject12-Jan-10 17:28 
Questiona problem about string Pin
Erdinc277-Jan-10 2:22
Erdinc277-Jan-10 2:22 
AnswerRe: a problem about string [modified] Pin
harold aptroot7-Jan-10 2:33
harold aptroot7-Jan-10 2:33 
GeneralRe: a problem about string Pin
Erdinc277-Jan-10 2:58
Erdinc277-Jan-10 2:58 
GeneralRe: a problem about string Pin
harold aptroot7-Jan-10 3:01
harold aptroot7-Jan-10 3:01 
GeneralRe: a problem about string [modified] Pin
Erdinc277-Jan-10 3:16
Erdinc277-Jan-10 3:16 
GeneralRe: a problem about string Pin
harold aptroot7-Jan-10 3:31
harold aptroot7-Jan-10 3:31 
GeneralRe: a problem about string Pin
harold aptroot7-Jan-10 3:33
harold aptroot7-Jan-10 3:33 
GeneralRe: a problem about string Pin
Erdinc277-Jan-10 3:42
Erdinc277-Jan-10 3:42 
GeneralRe: a problem about string Pin
harold aptroot7-Jan-10 3:45
harold aptroot7-Jan-10 3:45 
AnswerRe: a problem about string Pin
Ben Fair7-Jan-10 2:58
Ben Fair7-Jan-10 2:58 
GeneralRe: a problem about string Pin
Erdinc277-Jan-10 3:25
Erdinc277-Jan-10 3:25 
GeneralRe: a problem about string Pin
Ben Fair7-Jan-10 4:25
Ben Fair7-Jan-10 4:25 
QuestionDoes the IPv6 protocol deal with UDP datagrams ??? Pin
3bood.ghzawi7-Jan-10 2:08
3bood.ghzawi7-Jan-10 2:08 
AnswerRe: Does the IPv6 protocol deal with UDP datagrams ??? Pin
Dimitri Witkowski7-Jan-10 2:21
Dimitri Witkowski7-Jan-10 2:21 
AnswerRe: Does the IPv6 protocol deal with UDP datagrams ??? Pin
harold aptroot7-Jan-10 2:25
harold aptroot7-Jan-10 2:25 
QuestionGetting invalid IP address............. Pin
3bood.ghzawi7-Jan-10 1:51
3bood.ghzawi7-Jan-10 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.