以下表格申请中需要帮助。 [英] Help needed in the following Form Application.

查看:50
本文介绍了以下表格申请中需要帮助。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Windows窗体应用程序。第一个表单(Form1)包含一个ListBos和5个文本框。我创建了一个方法来显示列表框中的文本框内容(我也创建了一个文本文件)。

我在Form2中创建了一个列表框,它包含了第一个Form1中的三个文本框。

当我从Form1中选择列表框中的行时,内容显示在5个文本框中,其中包含以下代码:

I created a windows form application. The first form (Form1) holds a ListBos and 5 textboxes. I created a method to show the content of textboxes in a listbox (also i created a text file).
I created also a listbox in Form2 which holds three of textboxes from first Form1.
When i Select a row in listbox from Form1 the content is shown in 5 textboxes with following code:

string linjaListBox = this.ListBox.SelectedItem.ToString();

               string emriPjesa = linjaListBox.Split('\t')[0];
               string mbiemriPjesa = linjaListBox.Split('\t')[1];
               string datelindjaPjesa = linjaListBox.Split('\t')[2];
               string vendlindjaPjesa = linjaListBox.Split('\t')[3];
               string xhirollogariaPjesa = linjaListBox.Split('\t')[4];


               this.emriBox.Text = emriPjesa;
               this.mbiemriBox.Text = mbiemriPjesa;
               this.datelindjaBox.Text = datelindjaPjesa;
               this.vendlindjaBox.Text = vendlindjaPjesa;
               this.xhirollogariaBox.Text = xhirollogariaPjesa;
               indeksLista = Convert.ToInt32(ListBox.SelectedIndex.ToString());





我有以下问题?

如何显示 xhirollogaria.Box 存在于第二种形式(Form2)。

之后Form2的内容必须写在另一个文本文件中。



I have the following question?
How to show the content of those emri.Box mbiemri.Box and xhirollogaria.Box that exist in second form (Form2) if I select a row in Listbox from form1.
After that the content of Form2 it must bee written in another text file.

推荐答案

你好朋友



首先你使textbox访问说明符成为form2的公共



例如:private System.Windows.Forms.TextBox textBox1;

make it

public System.Windows.Forms.TextBox textBox1;



from designer



then创建form2的对象



即form2 f2 = new form2();



f2.textBox1 = what你想显示;
Hello friend

first you make textbox access specifier as a public of form2

eg : private System.Windows.Forms.TextBox textBox1;
make it
public System.Windows.Forms.TextBox textBox1;

from designer

then create object of form2

ie form2 f2 =new form2();

f2.textBox1 = what you want to display;


我使用以下方法填充表格2 onload解决了问题:

I solved the problem using following Method populating the form two onload:
Form2 frm2 = new Form2(emriBox.Text, mbiemriBox.Text, xhirollogariaBox.Text, statusi);
               frm2.Show();





我在Form1中写了这段代码。



谢谢你的回复。

PS如果我的软件有其他问题,我会在这个主题上提出一个问题。

干杯。



I wrote this code in Form1.

Thank you for your reply.
P.S. If I have another problem with my software, I''ll make a question in this topic.
Cheers.


这篇关于以下表格申请中需要帮助。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆