Beginner VB

Moderators: None (Apply to moderate this forum)
Number of threads: 1233
Number of posts: 2978

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Adding numbers,can somebody help? Posted by satsoc on 1 Apr 2002 at 9:11 AM
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
Report
Re: adding numbers Posted by hobby on 1 Apr 2002 at 12:33 PM
: 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:
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





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.