Results 1 to 6 of 6

Thread: Division with remainders

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    44

    Division with remainders


    I made this for my mom to check my sisters math homework
    Code:
    Option Explicit
    Dim a As Double
    Dim sd As Double
    Dim sc As Double
    
    Private Function RoundOff(ByVal value As Double, ByVal digits As Integer) As Double
    Dim move As Double
    
        move = 10 ^ digits
        RoundOff = CInt(value * move) / move
    End Functiona
    
    Private Sub Command1_Click()
    On Error Resume Next
    
    sc = Text1.Text / Text2.Text
    sd = RoundOff(CSng(sc), CInt(0))
    
    If sd > sc Then
    sd = sd - 1
    End If
    
    a = Text1.Text Mod Text2.Text
    Label1.Caption = sd & " r " & a
    Command2.Enabled = True
    net:
    Resume Next
    End Sub
    
    Private Sub Command2_Click()
    On Error Resume Next
    Text3.Text = sd & " * " & Text2.Text & " = " & Val(Text2.Text * sd)
    Text3.SetFocus
    SendKeys Text3.Text & "{Enter}"
    Text3.Text = Val(Text2.Text * sd) & " + " & a & " = " & Val(Text2.Text * sd + a)
    End Sub
    
    
    Private Sub Text1_Click()
    Text1.Text = ""
    End Sub
    
    
    Private Sub Text2_Click()
    Text2.Text = ""
    End Sub
    Project files

    Also: i would like someone to tell me how to use the enter key with text1.text = "Enter"?
    Attached Files Attached Files

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