本文介绍了将变量从datagridview传递到文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作库存系统。

至于我的添加产品:

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

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



示例:



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:

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.

推荐答案

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]);



这篇关于将变量从datagridview传递到文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:47
查看更多