如何替换文本 [英] How do I replace text

查看:98
本文介绍了如何替换文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个像这样的文本框文本64-66-73-64-66-61-73-64-66-61

但我想删除 - 所以它就像这样64 66 73 64 66 61 73 64 66 61



我尝试了什么:



我试过用这个



textBox2.Text = Text.Replace( - ,);



然后我总是得到Form2。

解决方案

Form2是Text属性你的形式。你想要使用textBox2.Text:



 textBox2.Text = textBox2.Text.Replace( - ,); 


Let's say i have a textbox text something like this "64-66-73-64-66-61-73-64-66-61"
but i want to remove "-" so it would be like this "64 66 73 64 66 61 73 64 66 61"

What I have tried:

I have tried using this

textBox2.Text = Text.Replace("-", " ");

but then then i always get "Form2" as a result.

解决方案

Form2 is the Text property of your form. You'll want to use textBox2.Text:

textBox2.Text = textBox2.Text.Replace("-", " ");


这篇关于如何替换文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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