beta3
2003-09-10, 17:41:14
hi
hab jezt ein prob und komme nicht weiter
hab mich an mein tutorial(sams teach you vs.net2003 in 21days) gehalten und alles getan, was dort stand
private void ListFolders_Click(object sender, System.EventArgs e)
{
/* Create s string variable named
* dirs to hold the directory entries for the
* special folder Program Files*/
string[] dirs = Directory.GetDirectories [***]
(Environment.GetFolderPath
(Environment.SpecialFolder.ProgramFiles));
/* Loop thru the array of folders and add them to the
*ListBox1 using the Items.Add method */
foreach (string dir in dirs)
{
listBox1.Items.Add(dir);
}
}
private void ListFiles_Click(object sender, System.EventArgs e)
{
// Clear the listBox1
listBox1.Items.Clear();
/* Create a string variable array named
* files to hold the directory and file entries for the
* special folder My Documents */
string[] files = Directory.GetFileSystemEntries [***]
(Environment.GetFolderPath
(Environment.SpecialFolder.Personal));
/* Loop thru the array of files and folders and add
*them to the ListBox1 using the Items.Add method */
foreach (string file in files)
{
listBox1.Items.Add(file);
}
}
private void WriteToFile_Click(object sender, System.EventArgs e)
{
// Create a new text file using the StreamWriter class
StreamWriter sw = new StreamWriter(@"c:\list.txt"); [***]
/* Loop thru the listBox, grabbing the items and
* writing them to the stream using the WriteLine method */
foreach (string s in listBox1.Items)
{
sw.WriteLine(s);
}
// Close the StreamWriter
sw.Close(); [***]
}
private void ReadFromFile_Click(object sender, System.EventArgs e)
{
// Clear the listBox1
listBox1.Items.Clear();
/* Create a new StreamReader and pass the file
* created in the WriteToFile_ClickEvent */
StreamReader sr = new StreamReader(@"c:\list.txt"); [***]
/* Use the peek method to move to the next character
* and the ReadLine method to get to the next line */
do
{
listBox1.Items.Add(sr.ReadLine()); [***]
}
while (sr.Peek() != -1); [***]
// Close the StreamReader
sr.Close(); [***]
}
ueberall wo das ist: [***](jetzt von mir hinzugefuegt), meldet der debugger einen fehler
verwende c# .net 2003
danke
hab jezt ein prob und komme nicht weiter
hab mich an mein tutorial(sams teach you vs.net2003 in 21days) gehalten und alles getan, was dort stand
private void ListFolders_Click(object sender, System.EventArgs e)
{
/* Create s string variable named
* dirs to hold the directory entries for the
* special folder Program Files*/
string[] dirs = Directory.GetDirectories [***]
(Environment.GetFolderPath
(Environment.SpecialFolder.ProgramFiles));
/* Loop thru the array of folders and add them to the
*ListBox1 using the Items.Add method */
foreach (string dir in dirs)
{
listBox1.Items.Add(dir);
}
}
private void ListFiles_Click(object sender, System.EventArgs e)
{
// Clear the listBox1
listBox1.Items.Clear();
/* Create a string variable array named
* files to hold the directory and file entries for the
* special folder My Documents */
string[] files = Directory.GetFileSystemEntries [***]
(Environment.GetFolderPath
(Environment.SpecialFolder.Personal));
/* Loop thru the array of files and folders and add
*them to the ListBox1 using the Items.Add method */
foreach (string file in files)
{
listBox1.Items.Add(file);
}
}
private void WriteToFile_Click(object sender, System.EventArgs e)
{
// Create a new text file using the StreamWriter class
StreamWriter sw = new StreamWriter(@"c:\list.txt"); [***]
/* Loop thru the listBox, grabbing the items and
* writing them to the stream using the WriteLine method */
foreach (string s in listBox1.Items)
{
sw.WriteLine(s);
}
// Close the StreamWriter
sw.Close(); [***]
}
private void ReadFromFile_Click(object sender, System.EventArgs e)
{
// Clear the listBox1
listBox1.Items.Clear();
/* Create a new StreamReader and pass the file
* created in the WriteToFile_ClickEvent */
StreamReader sr = new StreamReader(@"c:\list.txt"); [***]
/* Use the peek method to move to the next character
* and the ReadLine method to get to the next line */
do
{
listBox1.Items.Add(sr.ReadLine()); [***]
}
while (sr.Peek() != -1); [***]
// Close the StreamReader
sr.Close(); [***]
}
ueberall wo das ist: [***](jetzt von mir hinzugefuegt), meldet der debugger einen fehler
verwende c# .net 2003
danke