请帮忙修改此代码 [英] Please help to modify this code

查看:56
本文介绍了请帮忙修改此代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

For i As Integer = 0 To TextBox1.Lines.Count - 1
TextBox2.Text = TextBox1.Text
Next
For x = 0 To TextBox2.Lines.Count - 1
Dim str As String = TextBox2.Lines(x).ToString
Dim str1 = str.Split(",")(0).ToString
Dim str2 = str.Split(",")(1).ToString

Next



< br $>




我想插入一个子句组账号每一行Mikhaddh每行间隔和收集

我想要进入第一行

之后带来并确保结果

输入第二行,它删除第一行

带来和进入第二行到第三行,第二行删除

例如

1,+ 1 = 2

2,+ 2 = 4

5,+ 5 = 10

给我msgbox中每一行的结果





I want to insert a clause group accounts Eachd line Mikhaddh each line spaced and collected
I want to enter the first line
After what brings and make sure of the result
Enters the second line, and it deletes the first line
Brings and enters the second line to the third line and second line deletes
For example
1,+1=2
2,+2=4
5,+5=10
Give me the result of each line in the msgbox

推荐答案

也许你应该从你做的事情切换到一些有意识的编程。到目前为止,这根本不是编程。在编程中,您应该了解自己在做什么,输入的每个角色。让我们看看。



在循环中,您通过调用从 TextBox2.Lines(x)创建一个字符串,实际上 string.ToString 。它可以工作,因为所有类型都有方法 System.Object.ToString 。但为什么要从字符串中创建相同的字符串它已经是一个字符串。在接下来的两行中也是如此。现在, str1 str2 的目的是什么?当您退出循环的每次迭代时,这两个值将丢失并且对象被丢弃,最终将被垃圾收集破坏。



这不是编程,也不是学习编程的方法。如果你得到一些代码,我怀疑它会教你编写自己的代码。也许你需要尝试更简单的练习(它怎么可能比这更简单?我不知道;可能它可能;它取决于你的理解水平),但是按照你真正了解每个你的方式来做它们步骤。



-SA
Perhaps you should switch from what you doing to some conscious programming. So far, this is not programming at all. In programming, you should understand what you are doing, every character you enter. Let's see.

In the loop, you create a string from TextBox2.Lines(x) by calling, actually string.ToString. It works, because all type have the method System.Object.ToString. But why making an identical string from string? It is already a string. Same thing in the next two lines. Now, what's the purpose of str1 and str2? When you exit each iteration of your loop, these two values are lost and the object are discarded, will eventually be destructed by the Garbage Collection.

This is not programming and not the way to learn programming. If you get some code, I doubt it will teach you to write your own. Perhaps you need to try even simpler exercises (how it can be even simpler than this one? I don't know; probably it can be; it depends on your level of understanding), but do them the way you would really understand each your step.

—SA


这篇关于请帮忙修改此代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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