S
Skeletron
Guest
Load:
I used this code snippet in C# for a cracker that loaded lines of text into a listbox:
Save:
This is the exact opposite of the last code snippet but this one saves it to a text file:
Both of these code snippets are very easy to incorporate into your own project by changing the names in here to the updated names in your code.
It is also easy to modify so you can import it into a System.Collections.ArrayList or even a System.Collections.ObjectModel.Collection if you are using points etc.
I used this code snippet in C# for a cracker that loaded lines of text into a listbox:
{
this.listBox1.Items.Clear();
OpenFileDialog Open = new OpenFileDialog();
Open.Filter = "Text Document|*.txt|All Files|*.*";
try
{
Open.ShowDialog();
StreamReader Import = new StreamReader(Convert.ToString(Open.FileName));
while (Import.Peek() >= 0)
listBox1.Items.Add(Convert.ToString(Import.ReadLine()));
}
catch (Exception ex)
{
MessageBox.Show(Convert.ToString(ex.Message));
return;
}
}
Save:
This is the exact opposite of the last code snippet but this one saves it to a text file:
StreamWriter Write;
SaveFileDialog Open = new SaveFileDialog();
try
{
Open.Filter = ("Text Document|*.txt|All Files|*.*");
Open.ShowDialog();
Write = new StreamWriter(Open.FileName);
for (int I = 0; I < listBox4.Items.Count; I++)
{
Write.WriteLine(Convert.ToString(listBox4.Items));
}
Write.Close();
}
catch (Exception ex)
{
MessageBox.Show(Convert.ToString(ex.Message));
return;
}
Both of these code snippets are very easy to incorporate into your own project by changing the names in here to the updated names in your code.
It is also easy to modify so you can import it into a System.Collections.ArrayList or even a System.Collections.ObjectModel.Collection if you are using points etc.

