Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 136,297 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,429 people online right now. Registration is fast and FREE... Join Now!




[VB6] Simple Math Calc (need help^^)

 
Reply to this topicStart new topic

[VB6] Simple Math Calc (need help^^)

abelanger
26 Aug, 2008 - 10:16 PM
Post #1

New D.I.C Head
*

Joined: 26 Aug, 2008
Posts: 1

Hi everyone, first post yay! anyways im just trying to make a simple program that would have 3 text box (named: txt1, txt2,txt3) also with a button (named: Calculate). When i would click calculate, it would take the # from txt1 and divide it with the # in txt2, and would show the answer in txt3

so far i got this but its nothing

vb

Public Class Form1

Private Sub Calc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calc.Click
Dim velocity As Integer
Dim time As Integer
Dim txt1 As Integer
Dim txt2 As Integer
Dim txt3 As Integer

velocity = txt1
time = txt2
txt3 = velocity / time
End Sub
End Class


Also, let's say i change the formula around (let's i want to make the equation more complicated, is there any thing else i would need to change? or does it depend on what equation im trying to calculate for, like acceleration/force)
thanks any help is appreciated

Mod Edit: Please use code tags when posting your code. Code tags are used like so => code.gif

Thanks,
PsychoCoder smile.gif
User is offlineProfile CardPM
+Quote Post

DeCompile
RE: [VB6] Simple Math Calc (need Help^^)
27 Aug, 2008 - 04:42 PM
Post #2

D.I.C Head
**

Joined: 20 Jul, 2008
Posts: 180



Thanked: 6 times
My Contributions
Ok. I don't want to point out the obvious, but you're sub routine is from .net not VB6.

But to answer your question it would be as simple as:

private sub Calc_click
if textbox2.text > "0" then
dim velocity, time as integer
velocity = textbox1.text
time = textbox2.text
textbox3.text = velocity / time
end if
end sub

If you want to change the calculation you will have to change the formula.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: [VB6] Simple Math Calc (need Help^^)
27 Aug, 2008 - 04:43 PM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to VB.NET smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 06:03AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month