CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    May 2018
    Posts
    1

    How to make calculator that allows user to use only 1 decimal point and not more

    Im making a calculator as a school project and I would like to know how to make it so that only 1 decimal is allowed in the textbox. The current code that need's changing is (And I know its basic but im just learning it):

    Code:
    Private Sub btnNumber_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    	Handles btn0.Click, btn1.Click, btn2.Click, btn3.Click, btn4.Click,
    	btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click, btnDot.Click
    
    		Dim btnNumberClicked As Button = sender 'Contains properties of clicked button
    
    		If blnNewOp Then
    			Me.txtDisplay.Text = btnNumberClicked.Tag
    			blnNewOp = False
    		Else
    			Me.txtDisplay.Text = Me.txtDisplay.Text & btnNumberClicked.Tag
    		End If
    
    	End Sub
    Last edited by 2kaud; May 4th, 2018 at 03:44 AM. Reason: Added code tags

Tags for this Thread

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

Featured