![]() |
![]() |
|
![]() |
![]() |
|
Programmierung Rat & Tat für Programmierer |
![]() |
|
Themen-Optionen | Ansicht |
![]() |
#1 |
minderwertiges individuum
![]() |
![]() öffne in c# über den openFileDialog mehrere Dateien!
Code:
OpenFileDialog openFileDialog1 = new OpenFileDialog(); // save the last directorie the user has chosen if (last_dir != "0") openFileDialog1.InitialDirectory = last_dir; else openFileDialog1.InitialDirectory = "c:\\" ; openFileDialog1.Filter = "txt files (*.txt)|*.txt|htm files (*.htm)|*.htm|html files (*.html)|*.html" ; openFileDialog1.FilterIndex = 2 ; openFileDialog1.RestoreDirectory = true ; last_dir = openFileDialog1.FileName.ToString(); openFileDialog1.Multiselect = true; Code:
number_of_file_names = openFileDialog1.FileNames.Length; doch es kommt immer 0 zurück! was mach ich falsch? habs auch schon mit GetLength versucht! gleiches ergebnis! bidde um hilfe! |
![]() |
![]() |
![]() |
#2 |
bitte Mailadresse prüfen!
Registriert seit: 17.03.2002
Beiträge: 198
|
![]() Code:
OpenFileDialog openFileDialog1 = new OpenFileDialog(); // save the last directorie the user has chosen openFileDialog1.InitialDirectory = "c:\\" ; openFileDialog1.Filter = "txt files (*.txt)|*.txt|htm files (*.htm)|*.htm|html files (*.html)|*.html" ; openFileDialog1.FilterIndex = 2 ; openFileDialog1.RestoreDirectory = true ; openFileDialog1.Multiselect = true; openFileDialog1.ShowDialog(); int i=openFileDialog1.FileNames.Length; |
![]() |
![]() |
![]() |
#3 |
minderwertiges individuum
![]() |
![]() danke! hat gefunzt!
ich habs einfach 2 zeilen zu frü gschrieben! |
![]() |
![]() |
![]() |
#4 |
minderwertiges individuum
![]() |
![]() und ich steh scho wieder vor einem prob:
und zwar hab ich glaub ich irgendein buffer problem! Ich hab eine html datei, die ich zeile für zeile ausles und in eine neue schreib! und ich hab den punkt link entfernen hinzugefügt, der auch wunderbar funktioniert! nur seitdem schreibt er mir am ende der datei die letzten paar zeilen noch einmal hin! und ich krübel scho seit 2 std warum und komm nicht drauf! Code:
//MessageBox.Show("working"); label_status.Text="working"; // copies the htm_File in the temp_File, overwrite if exists File.Copy(array_file_names[i],temp_File,true); // open temp_File for reading FileStream fs = File.OpenRead(temp_File); // create streamReader instanz, combine with stream StreamReader sr = new StreamReader(fs); // open htm_File for writing FileStream fs1 = File.OpenWrite(array_file_names[i]); // create streamWriter instanz, combine with stream StreamWriter sw = new StreamWriter(fs1); //while not eof while ((sr.Peek())!=-1) { // store one line in zeile string zeile = sr.ReadLine(); string titel = "<title>" + textBox_titel.Text.ToString(); titel += "</title>"; // if zeile is equal with textBox_replace_string then replace it with // the string if (zeile.Equals(textBox_search_string.Text.ToString())) { //MessageBox.Show("gefunden,gefunden"); zeile = textBox_replace_string.Text.ToString(); label_status.Text="string found"; timer_status.Interval = 2500; timer_status.Start(); } if (checkBox_titel.Checked) { if (zeile.StartsWith("<title>")) { MessageBox.Show("titel"); zeile = titel; } } if (checkBox_link.Checked) { if ((zeile.StartsWith(" "))) { MessageBox.Show("link"); int end_of_link_line = zeile.IndexOf(">",1,zeile.Length-2); button_work.Text = end_of_link_line.ToString(); //zeile.TrimStart(zeile[20]); zeile = zeile.Remove(0,end_of_link_line+1); //button_work.Text = zeile.ToString(); } } sw.WriteLine(zeile); } // write buffer //sw.Flush(); sw.Close(); sr.Close(); Code:
<td align="center"> [img]../Bilder/P1010437_JPG.jpg[/img]</a> </td> </tr> </table> </body> </html> //ab da schreibt er immer was dazu!?! r/P1010437_JPG.jpg" border=0></a> </td> </tr> </table> </body> </html> |
![]() |
![]() |
![]() |
#5 |
minderwertiges individuum
![]() |
![]() keiner ne ahnung`?
|
![]() |
![]() |
![]() |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|