Hi, I just completed a beginner's course to programming, in the Python language.
I am now enrolled in a VB programming course, and I am more of a hands on type person, so I'd like to get a head start on things before the start of my class. I am trying to code an old Python project that I think would give me a better understanding of the way VB works and can't seem to get it right. Any help would be greatly appreciated!

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim target As Integer
        target = InputBox("How far away is the target")

        If target <= 20 Then
            Here I want to print to the screen, "Direct Hit!"
        ElseIf target < 40 Then
            Here I want to print to the screen, "Partial Hit!"
            Here I want to print to the screen, "Target Out Of Range!"
        End If

    End Sub
End Class

Recommended Answers

All 4 Replies

Two way.


Use Label controls for this.

Add Label controls to the form and then Use <LabelControl>.text="Something"

if i>5 then
me.Label1.Text="Hello World!"

2nd way

Use MsgBox.


MsgBox("Hello World!")

In a professional environment, which is the prefered method?

1st one.

Because 1st one used for printing on the form.

But 2nd one use for informing user by popping up a message.

If it helps give us reputation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.