简体   繁体   English

Windows窗体应用程序C#将文本传播到不同的文本框

[英]Windows form application c# spread text into different Textboxes

I have a string or TextBox which contains three words. 我有一个包含三个单词的字符串或TextBox

There is one space between words, and I want to move each word to three different TextBoxes as shown in the picture 有词之间有一个空格,我想每一个字移动到三个不同的TextBoxes如图所示图片

string theString = "hardy majid Ali";

            txt_first.Text = ?????;
            txt_second.Text = ?????;
            txt_3rd.Text = ?????;

How to achieve that? 如何实现呢? Thanks. 谢谢。

use split, like this code : 使用split,就像这样的代码:

var strs = theString.Split(' ');
txt_first.Text = strs[0];
txt_second.Text = strs[1];
txt_3rd.Text = strs[2];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#Windows窗体:通过动态创建的TextBox循环并检查Text是否已更改 - C# Windows Form: Looping through Dynamically created TextBoxes and checking to see if Text has changed 如何在文本框中输入一些文本之前禁用c#窗口表单应用程序中的按钮 - How to disable buttons in c# window form application before entering some text in textboxes 同时验证C#窗体上的多个文本框 - Validating several textboxes on a C# windows form at the same time C#Windows Form应用程序中每次单击时按钮文本的更改 - Button Text Change on Every Click in C# Windows Form Application C#Windows窗体应用程序 - C# windows form application C#Windows应用程序表单到HTML表单 - C# Windows Application Form to Html Form 相同的C#Windows Form应用程序从不同的打印机获得不同的打印尺寸 - Different print dimensions from different printers by same C# Windows Form Application C# Windows 窗体应用程序:如何使用循环将 5 个不同的数据放在 5 个不同的标签中 - C# Windows Form Application: How to put 5 different data in 5 different labels using a loop Windows窗体应用程序C#的搜索框 - Searchbox for Windows form application c# C#Windows窗体应用程序处理付款? - C# Windows Form Application Processing Payments?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM