Форум программистов, компьютерный форум, киберфорум
C# для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.86/42: Рейтинг темы: голосов - 42, средняя оценка - 4.86
4 / 4 / 1
Регистрация: 25.07.2010
Сообщений: 23
1

Работа с xml.

01.08.2010, 18:47. Показов 8198. Ответов 9
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Приветствую всех)

У меня есть xml файл. Мне нужно из него вытащить значение и присвоить его переменной.

Вопрос в том, можно ли вытащить значение, скажем, из 12 строки документа и назначить его переменной n или же ещё каким-то образом это сделать.

Искал на форуме и в гугле - нашёл много чего, но не понял, там более сложные вопросы рассматриваются.

Так же буду очень благодарен, если подскажете мне книгу или сайт, где можно почитать о С# и xml.
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
01.08.2010, 18:47
Ответы с готовыми решениями:

Работа с XML
Здравствуйте, у меня есть XML файл. Мне нужно возращать из него некие числа или буквы. Число...

Работа с xml
Добрый вечер, помогите с решениям задачи. Мне нужно вывести все CityName которые там есть из...

работа с XML
Здравствуйте. иемеется такой код<?xml version="1.0" encoding="windows-1251" ?> <ValCurs...

Работа с XML
1) Как получить содержимое тега? например есть такая конструкция: <day type="A"> ...

9
Padawan
473 / 323 / 30
Регистрация: 30.01.2010
Сообщений: 1,841
01.08.2010, 19:52 2
Пошерсти форум повнимательней, вот хотя бы на этой же странице тема
А вот почитать можно MSDN + Шилдт "Полный справочник по C#"
1
90 / 88 / 17
Регистрация: 30.10.2009
Сообщений: 562
02.08.2010, 11:54 3
Почитай "Джозеф Албахари, Бен Албахари. C# 3.0. Справочник". Там есть глава про парсинг xml, по-моему отлично изложено. В Шилдте насколько я помню про xml ничего не сказано, но как для начинающего книга хорошая
0
21 / 21 / 3
Регистрация: 24.07.2010
Сообщений: 161
02.08.2010, 12:16 4
Лови маленькую прогу для работы с XML. Она может прочитать с файла в список и записать в файл.
Думаю поможет.

[Ссылка устарела]
0
90 / 88 / 17
Регистрация: 30.10.2009
Сообщений: 562
02.08.2010, 14:21 5
всё же советую самому разобраться в этом, т.к. опыта ты не получишь работая с какой-то прогой. тем более парсинг xml, думаю, тебе пригодится не раз
0
4 / 4 / 1
Регистрация: 25.07.2010
Сообщений: 23
03.08.2010, 23:34  [ТС] 6
Спасибо Александру, но всё-таки я не хочу пользоваться прогами, а хочу набраться опыта, ведь это у меня главная цель на данный момент)
P.S.
Получилось уже всё)
0
90 / 88 / 17
Регистрация: 30.10.2009
Сообщений: 562
06.08.2010, 10:30 7
Так выкладывай код вдруг кому-нибудь понадобится, чтоб опять тему не создавали
1
21 / 21 / 3
Регистрация: 24.07.2010
Сообщений: 161
06.08.2010, 16:16 8
Код обработчиков событий:
Form1.cs
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
 
namespace Laba_4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        List<Item> items = new List<Item>();
        private void открsтьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "Файлы XML (*.xml)|*.xml";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                XmlTextReader reader = null;
                items.Clear();
 
                try
                {
                    reader = new XmlTextReader(dlg.FileName);
                    reader.WhitespaceHandling = WhitespaceHandling.None; // пропускаем пустые узлы 
 
                    while (reader.Read())
                    {
                        items.Add(new Item(
                            reader.GetAttribute("id"),
                            reader.GetAttribute("name"),
                            reader.GetAttribute("price")));
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ошибка: " + ex.Message);
                }
                finally
                {
                    if (reader != null)
                        reader.Close();
                }
                Print();
            }
        }
 
        private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            items.Add(new Item(comboBox1.Text, textBox2.Text, textBox3.Text));
            Print();
        }
 
        private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveDlg = new SaveFileDialog();
            saveDlg.DefaultExt = "xml";
            saveDlg.Filter = "Файлы XML (*.xml)|*.xml";
            if (saveDlg.ShowDialog() != DialogResult.OK)
                return;
 
            XmlTextWriter writer = null;
 
            try
            {
                writer = new XmlTextWriter(saveDlg.FileName, System.Text.Encoding.Unicode);
 
                writer.WriteStartDocument();
                writer.WriteStartElement("menu");
 
                // сохраняем заказы
                foreach (Item item in items)
                {
                    writer.WriteStartElement("item");
                    writer.WriteAttributeString("id", item.Id);
                    writer.WriteAttributeString("name", item.Name);
                    writer.WriteAttributeString("price", item.Price);
                }
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка: " + ex.Message);
            }
            finally
            {
                if (writer != null)
                    writer.Close();
            }
        }
 
        private void редактироватьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            items[Convert.ToInt32(textBox6.Text)].Id = comboBox2.Text;
            items[Convert.ToInt32(textBox6.Text)].Name = textBox4.Text;
            items[Convert.ToInt32(textBox6.Text)].Price = textBox5.Text;
            Print();
        }
 
        private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            items.RemoveAt(Convert.ToInt32(textBox7.Text));
            Print();
        }
 
        void Print()
        {
            richTextBox1.Text = "";
            int i = 0;
            foreach (Item item in items)
            {
                richTextBox1.Text += "№ п/п:" + i + ", название типа = " + item.Id + ", название  продукта = " + item.Name + ", цена продукта = " + item.Price + ".\n\n";
                i++;
            }
        }
 
        private void выходToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }
 
        private void перекодироватьВХТМЛToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "Файлы XML (*.xml)|*.xml";
 
            if (dlg.ShowDialog() != DialogResult.OK)
                return;
 
            string file = dlg.FileName;
 
            // получаем xsl файл
            dlg.Filter = "Файлы XSL (*.xslt)|*.xslt";
            if (dlg.ShowDialog() != DialogResult.OK)
                return;
 
            string fileXsl = dlg.FileName;
 
            // получаем имя выходного файла
            SaveFileDialog dlgSave = new SaveFileDialog();
            dlgSave.FileName = "transform";
            dlgSave.DefaultExt = "xml";
            dlgSave.Filter = "Файлы XML (*.xml)|*.xml";
 
            if (dlgSave.ShowDialog() != DialogResult.OK)
                return;
 
            string fileOut = dlgSave.FileName;
 
            XmlTextWriter writer = null;
 
            try
            {
                XPathDocument doc = new XPathDocument(file);
                XslTransform xsl = new XslTransform();
                writer = new XmlTextWriter(fileOut, System.Text.Encoding.Unicode);
                xsl.Load(fileXsl);
                xsl.Transform(doc, null, writer, (XmlResolver)null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка: " + ex.Message);
            }
            finally
            {
                if (writer != null)
                    writer.Close();
            }
        }
    }
}



Код формы:
Form1.Designer.cs
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
namespace Laba_4
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.файлToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.открsтьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.сохранитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.выходToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.textBox3 = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.textBox5 = new System.Windows.Forms.TextBox();
            this.textBox4 = new System.Windows.Forms.TextBox();
            this.label7 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.button2 = new System.Windows.Forms.Button();
            this.groupBox4 = new System.Windows.Forms.GroupBox();
            this.button3 = new System.Windows.Forms.Button();
            this.textBox7 = new System.Windows.Forms.TextBox();
            this.label8 = new System.Windows.Forms.Label();
            this.textBox6 = new System.Windows.Forms.TextBox();
            this.comboBox2 = new System.Windows.Forms.ComboBox();
            this.перекодироватьВХТМЛToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.menuStrip1.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.groupBox4.SuspendLayout();
            this.SuspendLayout();
            // 
            // richTextBox1
            // 
            this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.richTextBox1.Location = new System.Drawing.Point(3, 16);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.Size = new System.Drawing.Size(350, 191);
            this.richTextBox1.TabIndex = 0;
            this.richTextBox1.Text = "";
            // 
            // menuStrip1
            // 
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.файлToolStripMenuItem,
            this.перекодироватьВХТМЛToolStripMenuItem});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new System.Drawing.Size(706, 24);
            this.menuStrip1.TabIndex = 1;
            this.menuStrip1.Text = "menuStrip1";
            // 
            // файлToolStripMenuItem
            // 
            this.файлToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.открsтьToolStripMenuItem,
            this.сохранитьToolStripMenuItem,
            this.выходToolStripMenuItem});
            this.файлToolStripMenuItem.Name = "файлToolStripMenuItem";
            this.файлToolStripMenuItem.Size = new System.Drawing.Size(45, 20);
            this.файлToolStripMenuItem.Text = "Файл";
            // 
            // открsтьToolStripMenuItem
            // 
            this.открsтьToolStripMenuItem.Name = "открsтьToolStripMenuItem";
            this.открsтьToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
            this.открsтьToolStripMenuItem.Text = "Открыть";
            this.открsтьToolStripMenuItem.Click += new System.EventHandler(this.открsтьToolStripMenuItem_Click);
            // 
            // сохранитьToolStripMenuItem
            // 
            this.сохранитьToolStripMenuItem.Name = "сохранитьToolStripMenuItem";
            this.сохранитьToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
            this.сохранитьToolStripMenuItem.Text = "Сохранить";
            this.сохранитьToolStripMenuItem.Click += new System.EventHandler(this.сохранитьToolStripMenuItem_Click);
            // 
            // выходToolStripMenuItem
            // 
            this.выходToolStripMenuItem.Name = "выходToolStripMenuItem";
            this.выходToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
            this.выходToolStripMenuItem.Text = "Выход";
            this.выходToolStripMenuItem.Click += new System.EventHandler(this.выходToolStripMenuItem_Click);
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.richTextBox1);
            this.groupBox1.Location = new System.Drawing.Point(12, 27);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(356, 210);
            this.groupBox1.TabIndex = 2;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Отображение списка";
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.comboBox1);
            this.groupBox2.Controls.Add(this.textBox3);
            this.groupBox2.Controls.Add(this.label3);
            this.groupBox2.Controls.Add(this.textBox2);
            this.groupBox2.Controls.Add(this.label2);
            this.groupBox2.Controls.Add(this.label1);
            this.groupBox2.Controls.Add(this.button1);
            this.groupBox2.Location = new System.Drawing.Point(374, 27);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(320, 125);
            this.groupBox2.TabIndex = 3;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Добавление";
            // 
            // comboBox1
            // 
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Items.AddRange(new object[] {
            "Напитки",
            "Горячее",
            "Закуски"});
            this.comboBox1.Location = new System.Drawing.Point(124, 15);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(190, 21);
            this.comboBox1.TabIndex = 7;
            // 
            // textBox3
            // 
            this.textBox3.Location = new System.Drawing.Point(124, 69);
            this.textBox3.Name = "textBox3";
            this.textBox3.Size = new System.Drawing.Size(190, 20);
            this.textBox3.TabIndex = 6;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(7, 76);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(82, 13);
            this.label3.TabIndex = 4;
            this.label3.Text = "Цена продукта";
            // 
            // textBox2
            // 
            this.textBox2.Location = new System.Drawing.Point(124, 42);
            this.textBox2.Name = "textBox2";
            this.textBox2.Size = new System.Drawing.Size(190, 20);
            this.textBox2.TabIndex = 5;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(7, 49);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(106, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "Название продукта";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(6, 23);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(83, 13);
            this.label1.TabIndex = 2;
            this.label1.Text = "Название типа";
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(239, 95);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 1;
            this.button1.Text = "Добавить";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.добавитьToolStripMenuItem_Click);
            // 
            // groupBox3
            // 
            this.groupBox3.Controls.Add(this.comboBox2);
            this.groupBox3.Controls.Add(this.textBox5);
            this.groupBox3.Controls.Add(this.textBox6);
            this.groupBox3.Controls.Add(this.textBox4);
            this.groupBox3.Controls.Add(this.label7);
            this.groupBox3.Controls.Add(this.label6);
            this.groupBox3.Controls.Add(this.label5);
            this.groupBox3.Controls.Add(this.label4);
            this.groupBox3.Controls.Add(this.button2);
            this.groupBox3.Location = new System.Drawing.Point(374, 158);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(320, 163);
            this.groupBox3.TabIndex = 4;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Редактирование";
            // 
            // textBox5
            // 
            this.textBox5.Location = new System.Drawing.Point(124, 97);
            this.textBox5.Name = "textBox5";
            this.textBox5.Size = new System.Drawing.Size(190, 20);
            this.textBox5.TabIndex = 3;
            // 
            // textBox4
            // 
            this.textBox4.Location = new System.Drawing.Point(124, 71);
            this.textBox4.Name = "textBox4";
            this.textBox4.Size = new System.Drawing.Size(190, 20);
            this.textBox4.TabIndex = 2;
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(7, 78);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(106, 13);
            this.label7.TabIndex = 4;
            this.label7.Text = "Название продукта";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(7, 52);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(83, 13);
            this.label6.TabIndex = 3;
            this.label6.Text = "Название типа";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(7, 26);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(61, 13);
            this.label5.TabIndex = 2;
            this.label5.Text = "Номер п/п";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(7, 104);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(82, 13);
            this.label4.TabIndex = 1;
            this.label4.Text = "Цена продукта";
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(239, 123);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 0;
            this.button2.Text = "Обновить";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.редактироватьToolStripMenuItem_Click);
            // 
            // groupBox4
            // 
            this.groupBox4.Controls.Add(this.button3);
            this.groupBox4.Controls.Add(this.textBox7);
            this.groupBox4.Controls.Add(this.label8);
            this.groupBox4.Location = new System.Drawing.Point(12, 243);
            this.groupBox4.Name = "groupBox4";
            this.groupBox4.Size = new System.Drawing.Size(356, 78);
            this.groupBox4.TabIndex = 5;
            this.groupBox4.TabStop = false;
            this.groupBox4.Text = "Удаление";
            // 
            // button3
            // 
            this.button3.Location = new System.Drawing.Point(275, 45);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(75, 23);
            this.button3.TabIndex = 2;
            this.button3.Text = "Удалить";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.удалитьToolStripMenuItem_Click);
            // 
            // textBox7
            // 
            this.textBox7.Location = new System.Drawing.Point(160, 19);
            this.textBox7.Name = "textBox7";
            this.textBox7.Size = new System.Drawing.Size(190, 20);
            this.textBox7.TabIndex = 0;
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(15, 26);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(61, 13);
            this.label8.TabIndex = 1;
            this.label8.Text = "Номер п/п";
            // 
            // textBox6
            // 
            this.textBox6.Location = new System.Drawing.Point(124, 19);
            this.textBox6.Name = "textBox6";
            this.textBox6.Size = new System.Drawing.Size(190, 20);
            this.textBox6.TabIndex = 4;
            // 
            // comboBox2
            // 
            this.comboBox2.FormattingEnabled = true;
            this.comboBox2.Items.AddRange(new object[] {
            "Напитки",
            "Горячее",
            "Закуски"});
            this.comboBox2.Location = new System.Drawing.Point(124, 44);
            this.comboBox2.Name = "comboBox2";
            this.comboBox2.Size = new System.Drawing.Size(190, 21);
            this.comboBox2.TabIndex = 8;
            // 
            // перекодироватьВХТМЛToolStripMenuItem
            // 
            this.перекодироватьВХТМЛToolStripMenuItem.Name = "перекодироватьВХТМЛToolStripMenuItem";
            this.перекодироватьВХТМЛToolStripMenuItem.Size = new System.Drawing.Size(144, 20);
            this.перекодироватьВХТМЛToolStripMenuItem.Text = "Перекодировать в ХТМЛ";
            this.перекодироватьВХТМЛToolStripMenuItem.Click += new System.EventHandler(this.перекодироватьВХТМЛToolStripMenuItem_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(706, 343);
            this.Controls.Add(this.groupBox4);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.menuStrip1);
            this.MainMenuStrip = this.menuStrip1;
            this.Name = "Form1";
            this.Text = "Мего программулина для ХМЛя";
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.groupBox4.ResumeLayout(false);
            this.groupBox4.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
 
        #endregion
 
        private System.Windows.Forms.RichTextBox richTextBox1;
        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.ToolStripMenuItem файлToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem открsтьToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem сохранитьToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem выходToolStripMenuItem;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.TextBox textBox2;
        private System.Windows.Forms.TextBox textBox3;
        private System.Windows.Forms.ComboBox comboBox1;
        private System.Windows.Forms.TextBox textBox5;
        private System.Windows.Forms.TextBox textBox4;
        private System.Windows.Forms.GroupBox groupBox3;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.GroupBox groupBox4;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.TextBox textBox7;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.ComboBox comboBox2;
        private System.Windows.Forms.TextBox textBox6;
        private System.Windows.Forms.ToolStripMenuItem перекодироватьВХТМЛToolStripMenuItem;
    }
}
1
17 / 17 / 1
Регистрация: 22.02.2012
Сообщений: 116
12.04.2013, 21:03 9
List<Item> items // Что такое Item??? Откуда оно взялось???
0
2 / 2 / 2
Регистрация: 24.11.2012
Сообщений: 60
13.04.2013, 23:04 10
Откройте файл, посчитайте до 12й строки, найдите интересующий символ и присвойте.
Если же речь идет о том, как записать класс в xml и обратно, или же что то в этом духе, тогда Сериализация в помощь
0
13.04.2013, 23:04
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
13.04.2013, 23:04
Помогаю со студенческими работами здесь

Работа c xml
Привет всем! Есть проблемка, с классами по работе с xml я не слишком знаком и по документации в...

Работа с xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;data&gt; &lt;Операторы&gt; &lt;function name...

работа с XML
почему то при попытке сохранения фаила, сам фаил вроде норм сохраняется, но выводится ссобщение...

Работа с xml
Для сохранения настроек программы хочу использовать xml. Подскажите где можно посмотреть примеры...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
10
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru