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
I'm not familiar with VB, but assuming that & is the concatenation operator, I would have thought something like: lblOutput.Text = lblOutput.Text & "Your Speed Was " & Speed & "mph"
I'm not familiar with VB, but assuming that & is the concatenation operator, I would have thought something like:
lblOutput.Text = lblOutput.Text & "Your Speed Was " & Speed & "mph"
Only 1 answer
Do you know the answer?
How Do I Add An Extra Line To A Label In Visual Basic
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.