Results 1 to 3 of 3

Thread: Bit Of Maths

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    10

    Question

    Need a bit of help.

    A user enters some information into a textbox, in a format eg. 10*21. I want it so that when a user clicks Command1 or whatever, it works out the maths and places it in another textbox.
    Eg.

    Private Sub Command1_Click
    Dim math As String
    math = Form1.Text1.Text
    'what go-
    'es here?
    End Sub

    Any ideas?

    Regards,
    Phil


  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,092

    try this

    Code:
    Dim nums as Variant
    
    Private Sub Command1_Click()
    if InStr(1,Text1.Text,"*") Then
       nums = Split(Text1.Text,"*")
       Text2.Text = nums(0) * nums(1)
    Endif
    End Sub
    Be sure to add elseif's in there if you want to check for other operators

  3. #3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width