在文本框中添加单词时求和一个变量 [英] Sum a variable when word is adding in text box

查看:50
本文介绍了在文本框中添加单词时求和一个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好小组成员,

我已经完成了使用下面的多行文本框的文本更改事件来计算多行文本框中的单词数的任务.但是对于每个单词,我需要为临时变量添加值10.我的问题是如果我输入5个单词并且我得到的单词正确,但是每个单词的变量无法添加10.有什么可以帮助我解决此问题的吗?

Hello Group members,

I have done task to count number of words in multiline text-box using text change event for multiline text-box below is the code .But for each word I need to add value 10 for temporary variable.My problem is if I type 5 words and I am getting correct words ,But unable to add 10 for variable for each word.Can any help me to solve this problem

char[] holdchars = { ' ', '\r', '\n' };
          string[] strs = txtstory.Text.Split(holdchars, StringSplitOptions.RemoveEmptyEntries);
          txttotalwords.Text = strs.Length.ToString();

推荐答案

这是您想要的吗?
is this what u want?
char[] holdchars = { '' '', ''\r'', ''\n'' };
string[] strs = txtstory.Text.Split(holdchars,StringSplitOptions.RemoveEmptyEntries);
//txttotalwords.Text = strs.Length.ToString();
int intValue = (strs.Count())*10;
txttotalwords.Text = intValue.ToString();


这篇关于在文本框中添加单词时求和一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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