需要帮助制作程序按钮和文本。 [英] Need Help making a program Buttons and Text.

查看:61
本文介绍了需要帮助制作程序按钮和文本。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿。

所以我一直在用 Visual Studio 2010 创建一个程序对于我的世界。它意味着是一个结界文本转换器。我遇到的问题是:

So iv'e been making a program with Visual Studio 2010 for Minecraft. It's meant to be a Enchantment text converter. The problem I'm having is :

我有26个按钮,当我点击第一个按钮时,字母"A"进入文本框。然后,我点击字母"B"的按钮。并且文本框删除字母"A"。并添加字母"B"。我想要它,以便当你点击
中的任何一个26按钮时,它会进入文本框而不是删除字母并用一个字母替换它。我很好的例子是windows中的字符映射。如果你点击多个字母,它们就会加到文本框中。

I have 26 buttons and when I click the first button, the letter "A" comes in to the textbox. Then I click the button for the letter "B" and the textbox removes the letter "A" and adds the letter "B". I want it so that that when you click any of the 26 buttons it's comes into the textbox rather than removes the letter and replaces it with one letter. I good example is the character map in windows. if you click multiple letters it all adds up to the textbox.

这是我的代码:

Public Class Form1

    Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs)

    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        RichTextBox1.Text = "a"

    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        RichTextBox1.Text = "b"
    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        RichTextBox1.Text = "c"
    End Sub

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
        RichTextBox1.Text = "d"
    End Sub

    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
        RichTextBox1.Text = "e"
    End Sub

    Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
        RichTextBox1.Text = "f"
    End Sub

    Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
        RichTextBox1.Text = "g"
    End Sub

    Private Sub Button14_Click(sender As System.Object, e As System.EventArgs) Handles Button14.Click
        RichTextBox1.Text = "h"
    End Sub

    Private Sub Button13_Click(sender As System.Object, e As System.EventArgs) Handles Button13.Click
        RichTextBox1.Text = "i"
    End Sub

    Private Sub Button12_Click(sender As System.Object, e As System.EventArgs) Handles Button12.Click
        RichTextBox1.Text = "j"
    End Sub

    Private Sub Button11_Click(sender As System.Object, e As System.EventArgs) Handles Button11.Click
        RichTextBox1.Text = "k"
    End Sub

    Private Sub Button22_Click(sender As System.Object, e As System.EventArgs) Handles Button22.Click
        RichTextBox1.Text = "y"
    End Sub

    Private Sub Button23_Click(sender As System.Object, e As System.EventArgs) Handles Button23.Click
        RichTextBox1.Text = "x"
    End Sub

    Private Sub Button24_Click(sender As System.Object, e As System.EventArgs) Handles Button24.Click
        RichTextBox1.Text = "w"
    End Sub

    Private Sub Button25_Click(sender As System.Object, e As System.EventArgs) Handles Button25.Click
        RichTextBox1.Text = "v"
    End Sub

    Private Sub Button15_Click(sender As System.Object, e As System.EventArgs) Handles Button15.Click
        RichTextBox1.Text = "u"
    End Sub

    Private Sub Button16_Click(sender As System.Object, e As System.EventArgs) Handles Button16.Click
        RichTextBox1.Text = "t"
    End Sub

    Private Sub Button17_Click(sender As System.Object, e As System.EventArgs) Handles Button17.Click
        RichTextBox1.Text = "s"
    End Sub

    Private Sub Button18_Click(sender As System.Object, e As System.EventArgs) Handles Button18.Click
        RichTextBox1.Text = "r"
    End Sub

    Private Sub Button19_Click(sender As System.Object, e As System.EventArgs) Handles Button19.Click
        RichTextBox1.Text = "q"
    End Sub

    Private Sub Button20_Click(sender As System.Object, e As System.EventArgs) Handles Button20.Click
        RichTextBox1.Text = "p"
    End Sub

    Private Sub Button21_Click(sender As System.Object, e As System.EventArgs) Handles Button21.Click
        RichTextBox1.Text = "o"
    End Sub

    Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles Button8.Click
        RichTextBox1.Text = "n"
    End Sub

    Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles Button9.Click
        RichTextBox1.Text = "m"
    End Sub

    Private Sub Button10_Click(sender As System.Object, e As System.EventArgs) Handles Button10.Click
        RichTextBox1.Text = "l"
    End Sub

    Private Sub Button28_Click(sender As System.Object, e As System.EventArgs) Handles Button28.Click
        RichTextBox1.Text = "z"
    End Sub

    Private Sub Button26_Click(sender As System.Object, e As System.EventArgs) Handles Button26.Click
        RichTextBox1.Text = ""
    End Sub

    Private Sub Button27_Click(sender As System.Object, e As System.EventArgs) Handles Button27.Click
        Me.Close()

    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

推荐答案

如果要向Text属性添加内容,可以将字符串连接与+运算符一起使用:

If you want to add something to the Text property, you can use the string concatenation with the + operator:

RichTextBox1.Text = RichTextBox1.Text +" a"

RichTextBox1.Text = RichTextBox1.Text + "a"

同时请注意:此论坛仅涵盖开发人员文档和MS帮助系统。 VB问题应该在VB论坛内提出。

And also be aware: this forum covers the developer documentation and MS Help System only. VB questions should be asked inside a VB forum instead.

亲切的问候,

Konrad


这篇关于需要帮助制作程序按钮和文本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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