将变量从datagridview传递到文本框

问题描述:

我正在制作库存系统。

至于我的添加产品:

我创建了3个文本框(仅用于描述产品)

3 textbox cotains:产品名称,尺寸和尺寸;其他。这3个文本框将作为一个输入描述行,现在我想将产品更新(传递变量)到文本框中。我的问题是如何拆分我的描述条目以将变量传递到3个文本框中。



示例:

模型|品牌| Descripion

TCS-21 |怪物| Handlebar 2x2x2 inc StainlessSteel



我希望描述行传递变量以显示3个textboes中的数据..



TextBox1(名称)=车把

TextBox2(Dimension)= 2x2x2 inc

TextBox3(其他)= StainlessSteel







谢谢。



我是什么尝试过:



截至目前,我什么也没做,因为我不知道怎么开始。

Hi, I am making an inventory system.
As for my adding products :
I creat 3 textbox (for the description product only)
3 textbox cotains: Product Name, Dimension & Others. This 3 textbox will entry to a description row as one, and now I want to do an Update of the product (passing variable) into textboxes. My question is How can I split my description entry to pass the varible into 3 textboxes.

Example:
Model | Brand | Descripion
TCS-21 | Monster | Handlebar 2x2x2 inc StainlessSteel

I want the description row to pass the variable to show the data in the 3 textboes..

TextBox1(Name) = Handlebar
TextBox2(Dimension) = 2x2x2 inc
TextBox3(Others) = StainlessSteel



Thank you.

What I have tried:

As of now, I did nothing coz I don't know how to start.

根据此处发布的内容。假设您可以修改代码以保存描述以包含分隔符。示例车把| 2x2x2 inc | StainlessSteel。然后你可以修改代码来做类似的事情

Based on what posted here. Let assumed you can modify the code to save the description to include a deliminator. Example "Handlebar|2x2x2 inc|StainlessSteel". Then you can modify the code to do something like
string description= "Handlebar|2x2x2 inc|StainlessSteel";
string[] descriptions= description.Split('|');

//assuming position 0 is for textbox1, 1=textbox2, 2=textbox3

TextBox1(Name) = descriptions[0];
TextBox2(Dimension) = descriptions[1];
TextBox3(Others) = descriptions[2];

//System.Console.WriteLine(descriptions[0]);
//System.Console.WriteLine(descriptions[1]);
//System.Console.WriteLine(descriptions[2]);


如果我有这个先生怎么办?手柄杆2x2x2 inc钢型;



然后它将在文本框上显示为

TextBox1 =手柄杆;

TextBox2 = 2x2x2 inc;

textbox3 =钢铁类型;



这是可能的还是我需要放一些特殊的字符来分割句子?



谢谢。
what if I have this sir? Handle bar 2x2x2 inc steel type;

then It will display on textbox as
TextBox1 = Handle bar;
TextBox2 = 2x2x2 inc;
textbox3 = steel type;

Is this possible or do I need to put some special char to split the sentence?

Thank you.