All pastes #623617 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-17 18:55 UTC
rendered paste body
public static void ImportO(ListBox Lst)
        {
            Lst.Items.Clear();
            OpenFileDialog Open = new OpenFileDialog();
            Open.Filter = "Text Document|*.txt|All Files|*.*";
            try
            {
                Open.ShowDialog();
                Import(Lst, Open.FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                return;
            }
        }
        public static void ImportO(System.Collections.ArrayList Array)
        {
            Array.Clear();
            OpenFileDialog Open = new OpenFileDialog();
            Open.Filter = "Text Document|*.txt|All Files|*.*";
            try
            {
                Open.ShowDialog();
                Import(Array, Open.FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                return;
            }
        }
        public static void Clear(ListBox Lst)
        {
            Lst.Items.Clear();
        }
        public static void Add(ListBox Lst, String Strings)
        {
            if (Strings == "")
            {
                return;
            }
            try
            {
                Lst.Items.Add(Strings);
            }
            catch
            {
                return;
            }
        }
        public static void Remove(ListBox Lst)
        {
            Lst.Items.RemoveAt(Lst.SelectedIndex);
        }
        public static void SaveIt(ListBox Lst, String FileName)
        {
            StreamWriter Write;
            try
            {
                Write = new StreamWriter(FileName);
                for (int I = 0; I < Lst.Items.Count; I++)
                {
                    Write.WriteLine(Convert.ToString(Lst.Items[I]));
                }
                Write.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                return;
            }
        }
        public static void SaveS(ListBox Lst)
        {
            SaveFileDialog Open = new SaveFileDialog();
            Open.Filter = ("Text Document|*.txt|All Files|*.*");
            try
            {
                Open.ShowDialog();
                SaveIt(Lst, Open.FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                return;
            }
        }
        public static void Import(ListBox Lst, String FileName)
        {

            try
            {
                StreamReader Open = new StreamReader(Convert.ToString(FileName));
                while (Open.Peek() >= 0)
                {
                    Lst.Items.Add(Convert.ToString(Open.ReadLine()));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                return;
            }
        }
        public static void Import(System.Collections.ArrayList Array, String FileName)
        {

            try
            {
                StreamReader Open = new StreamReader(Convert.ToString(FileName));
                while (Open.Peek() >= 0)
                {
                    Array.Add(Convert.ToString(Open.ReadLine()));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                return;
            }
        }