将字符串添加到visual basic窗体

时间:2010-09-18 21:11:13

标签: vb.net

如何在视觉基本表单中添加字符串?

我正在为自己创建一个学习应用程序,这就是我所拥有的:

Imports System.Diagnostics
Public Class Form1

Dim amounts As Integer


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

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Processes.Tick
    Dim proc() As Process = Process.GetProcesses
    Dim newproc As New Process
    amounts = 0
    For Each newproc In proc
        If newproc.ProcessName = "firefox" Then
            newproc.Kill()
            amounts = +1

        Else

        End If
    Next
End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

End Sub

结束班

我正在尝试在我的表单上显示一行文字说:“防止firefox运行X次。

X是我的“金额”变量。

以下是我的表单:http://img696.imageshack.us/img696/8162/programq.png

那么如何将我的金额变量代替X?

2 个答案:

答案 0 :(得分:1)

假设您有一个名为yourLabel的标签:

''# my personally preferred way
yourLabel.Text = String.Format("Prevented FireFox from running {0} times", _
                               amounts)

''# straight-forward concatenation
yourLabel.Text = "Prevented FireFox from running " & amount & " times"

''# using String.Concat (which is what the above code will be compiled to)
yourLabel.Text = String.Concat("Prevented FireFox from running ",amount," times")

答案 1 :(得分:0)

试试吧

msgbox("Prevented FireFox from running " & amount & " times")