tags:

views:

32

answers:

2

My question is simple yet difficult to find an answer for. I declared a variable which is the sum of two other variables. I simply want to display that result on the screen. I think a msgbox is what I need to use but I'm not sure.

A: 

You can do like this:

MsgBox(total)
Sarfraz
okay, if I wanted to say: "The sum of these numbers is: (total)", how would I go about that?
A-moc
rockinthesixstring
A-moc
belisarius
Assuming total is an integer or some other numerical type and you're using .NET, you can gain type safety by using Msgbox(total.tostring). If you're using VB6, Str(Total) will give you your type safety.
DaMartyr
A: 

Well are you using a website or winforms?

If you're using a website, just create a label:

<asp:Label ID="lblMessage" runat="server" />

Then in your code behind, just set the message.

Dim Variable as Int
lblMessage.Text = Variable.ToString();

The same can be used above on a WinForm, but in a Winform you can also use:

MessageBox.Show(....);
Jack Marchetti
fyi.. he didn't state that he's using .NET - thought I do the same thing and default to .NET when I'm answering these things.
rockinthesixstring