VB.NET 2010 express:自动程序按文本框中的回车键! [英] VB.NET 2010 express: Automaticly the program to press the enter button in a textbox!

查看:202
本文介绍了VB.NET 2010 express:自动程序按文本框中的回车键!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

程序从文本框1逐个读取字母并通过文本框3将其复制到文本框2.

我希望每次 TextBox3 =(空格)文本框2更改行(按回车键)。

Program that reads from text box 1 one by one the letters and copy it to the text box 2 via text box 3.
I would like that every time that TextBox3 = " " (space) the text box 2 to change the line (press enter key).

Public Class Form1
    Dim ptkati As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        pb1.Maximum = TextBox1.TextLength + 1
        TextBox3.Clear()
        TextBox2.Clear()
        pb1.Value = 0

        For Me.ptkati = 0 To TextBox1.TextLength
            TextBox1.Focus()
            TextBox1.SelectionStart = Me.ptkati
            TextBox1.SelectionLength = TextBox1.SelectionStart - (TextBox1.SelectionStart - 1)
            pb1.Value = pb1.Value + 1
            TextBox3.AppendText(TextBox1.SelectedText)
            TextBox2.Text = TextBox2.Text & TextBox3.Text
            If TextBox3.Text = " " Then
               
'I know that I have to put something right here but I don't what!

            End If
            TextBox3.Clear()
        Next
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = "If you trer ie nearest eollowing code shows examples of roundi trer ie nearest eollowing code shows examples of rounding"
    End Sub
End Class

推荐答案

如果你只想在那个时候在TextBox2.Text中插入换行符,那么使用

If you just want a newline to be inserted in TextBox2.Text at that point then use
TextBox2.Text += vbCrLf



请记住确保文本框的Multiline属性设置为true。



我不确定你的代码是否会实际执行你希望它做的事情


Remember to make sure that the Multiline property of the text box is set to true.

I''m not sure your code will actually do what you appear to want it to do though


这篇关于VB.NET 2010 express:自动程序按文本框中的回车键!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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