Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Adding numbers,can somebody help?

satsocsatsoc Member Posts: 19
allthough i know many computer languages VB is not my speciallity.so i just want to create a simple program that adds two numbers that we type from keyboard and prints the result.my problem is that i don't know how can i input these nums.

any help would be really appreciated

Comments

  • hobbyhobby Member Posts: 84
    : allthough i know many computer languages VB is not my speciallity.so i just want to create a simple program that adds two numbers that we type from keyboard and prints the result.my problem is that i don't know how can i input these nums.
    :
    : any help would be really appreciated
    :

    Stick three textboxes on a form and a command button. Name the third textbox txt_Result. Set the caption of the command button to "Find Sum"

    Add the following code to your form:
    [code]
    Private Sub Command1_Click()
    if text1.text = vbnullstring OR text2.text = vbnullstring then
    msgbox "Please enter a number in each textbox."
    exit sub
    end if
    txt_Result.text = Val(text1.text) + Val(text2.text)
    End Sub
    [/code]

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ________ ( http://forcoder.org ) free ebooks and video tutorials about \ PL/SQL, JavaScript, Visual Basic, C++, Ruby, Python, Go, Java, Assembly, MATLAB, Visual Basic .NET, C, Delphi, Objective-C, Scratch, Swift, Perl, PHP, R, C# Scala, VBScript, Scheme, Julia, F#, COBOL, SAS, Lua, Awk, Hack, Transact-SQL, FoxPro, ABAP, LabVIEW, Apex, Lisp, Erlang, Bash, Prolog, Rust, Ada, Logo, Fortran, Clojure, Alice, Dart, D, Kotlin, Crystal, ML \ _

Sign In or Register to comment.