Donate SIGN UP

How Do I Add An Extra Line To A Label In Visual Basic

Avatar Image
TheGuyCalledJam | 21:15 Tue 17th Nov 2015 | Technology
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
Gravatar

Answers

Only 1 answerrss feed

Avatar Image
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"
23:59 Tue 17th Nov 2015
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 answerrss feed

Do you know the answer?

How Do I Add An Extra Line To A Label In Visual Basic

Answer Question >>

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.