ChatterBank3 mins ago
How Do I Add An Extra Line To A Label In Visual Basic
1 Answers
I am a n00b to visual basic, i have done it before but i lost the project and completely forgot how to do it. I am trying to list in a label and every time someone inputs a time, it calculates the speed using the distance and time then outputs it. The problem is that when it outputs it replaces what is currently inside the label, but i want it to add to it. This is my code:
Public Class Form1
Dim Time As Integer
Dim Speed As Integer
Const Distance As Integer = 350
Private Sub btnCalculate_Click(sender As System.Object, e As System.EventArgs) Handles btnCalculate.Click
Time = txtInput.Text
Speed = Distance / Time
lblOutput.Text = "Your Speed Was " & Speed & "mph"
End Sub
Public Class Form1
Dim Time As Integer
Dim Speed As Integer
Const Distance As Integer = 350
Private Sub btnCalculate_Click(sender As System.Object, e As System.EventArgs) Handles btnCalculate.Click
Time = txtInput.Text
Speed = Distance / Time
lblOutput.Text = "Your Speed Was " & Speed & "mph"
End Sub
Answers
I'm not familiar with VB, but assuming that & is the concatenatio n operator, I would have thought something like: lblOutput. Text = lblOutput. Text & "Your Speed Was " & Speed & "mph"
22:59 Tue 17th Nov 2015
Related Questions
Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.