Re: Division with remainders
Quote:
Originally Posted by Snowfox
Also: i would like someone to tell me how to use the enter key with text1.text = "Enter"?
Use the Textbox's KeyUp Event:
vb Code:
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then 'Check if return Key was pressed
Call Command1_Click
End If
End Sub
But you will have to build in some sort of error tapping just in case the user does enter a value in either of the Textboxes. Otherwise a nice piece of code. :thumb:
Re: Division with remainders
Thats not what i meant, i mean like in a multi line enabled textbox how do i use Text1.text = "{enter}" Which would skip a line.
Re: Division with remainders
Quote:
Originally Posted by Snowfox
Thats not what i meant, i mean like in a multi line enabled textbox how do i use Text1.text = "{enter}" Which would skip a line.
I don't understand? :confused: :confused: :confused: If you hold down the Control Key and Press the Return key the cursor will then go to the next line in the textbox provided that the Multiline property is set to True.
Re: Division with remainders
Text1.Text = Text1.Text & vbCrLf
this? To add a line change to the textbox?
Re: Division with remainders
This seems overcoded to me. Much simpler would be:
Code:
Private Sub Command1_Click()
Dim lngDividend As Long
Dim lngDivisor As Long
Dim lngQuotient As Long
Dim lngRemainder As Long
lngDividend = Val(Text1.Text)
lngDivisor = Val(Text2.Text)
lngQuotient = lngDividend \ lngDivisor
lngRemainder = lngDividend Mod lngDivisor
Label1.Caption = lngQuotient & " r " & lngRemainder
Text3.Text = lngQuotient & " * " & lngDivisor & " = " & lngQuotient * lngDivisor & vbNewLine & _
lngQuotient * lngDivisor & " + " & lngRemainder & " = " & lngQuotient * lngDivisor + lngRemainder
End Sub