簡體   English   中英

將字符串添加到視覺基本形式

[英]Adding a string to visual basic form

如何在我的視覺基本表單中添加字符串?

我正在為自己創建一個學習應用程序,這是我所擁有的:

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?

假設您有一個名為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")

去嘗試一下

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM