Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- using System.IO;
- namespace Storage
- {
- struct Tovar
- {
- public string Name; //наименование
- public double Price; //Стоимость
- public string Sort; //Сорт
- public int Amount; //Количество
- }
- public partial class Form1 : Form
- {
- Tovar[] MyStorage;
- int Size; //Кол-во различных товаров различных видов
- public Form1()
- {
- InitializeComponent();
- string[] str; //массив строк
- //считывание данных из файла в массив строк
- str = File.ReadAllLines(@"d:\storage.txt");
- int n = str.Length; //определение количества элементов в массиве
- //каждый вопрос в файле занимает 7 строк
- Size = n / 4; //определение количества вопросов в файле
- MyStorage = new Tovar[Size];
- int m = 0;
- //заполнение массива товаров
- for (int j = 0; j < Size; j++)
- {
- MyStorage[j].Name = str[m]; m++;
- MyStorage[j].Price = Convert.ToInt32(str[m]); m++;
- MyStorage[j].Sort = str[m]; m++;
- MyStorage[j].Amount = Convert.ToInt32(str[m]); m++;
- }
- Label label1 = new Label();
- label1.Text = "Введите минимальную стоимость товара";
- label1.Location = new Point(15, 15);
- label1.Size = new Size(150,15);
- this.Controls.Add(label1);
- TextBox textBox1 = new TextBox();
- textBox1.Location = new Point(15, 40);
- this.Controls.Add(textBox1);
- Button button1 = new Button();
- button1.Text = "ОК";
- button1.Location = new Point(15, 70);
- button1.Click += Button1_Click;
- this.Controls.Add(button1);
- }
- private void Button1_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement