Posts

Write a Visual Basic program to find the mouse position on screen and number click made by user on screen.

Image
Write a Visual Basic program to find the mouse position on screen and number click that is Left, Right and Double made by user on screen form . First Design Form Window (mousepose.frm):- Second Design Form Window (summary.frm):- Code:- for first form Dim cnt As Integer Dim cnt1 As Integer Dim cnt2 As Integer Private Sub Command1_Click() Form2.Show Form2.Text1.Text = cnt Form2.Text2.Text = cnt1 Form2.Text3.Text = cnt2 End Sub Private Sub Form_DblClick() cnt2 = cnt2 + 1 LblDblClick.Caption = cnt2 End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then     cnt = cnt + 1     LblLeftClick.Caption = cnt End If If Button = vbRightButton Then     cnt1 = cnt1 + 1     LblRightClick.Caption = cnt1 End If End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim strpos As String Dim xpos As Integer ...

Write a Visual Basic program to calculate Sum of the Even digits of a given number.

Image
  Write a Visual Basic program to calculate Sum of the Even digits of a given number. Designing window :- Take the following tools form toolbox in form. Code:- Private Sub cmdClear_Click() Text1.Text = "" Text2.Text = "" Text1.SetFocus End Sub Private Sub cmdSum_Click()     n = Val(Text1.Text)     While n > 0         r = n Mod 10         n = n \ 10         If r Mod 2 = 0 Then             s = s + r         End If         Text2.Text = s     Wend End Sub Private Sub cmFxit_Click() Unload Me End Sub Private Sub Form_Activate() Text1.SetFocus End Sub =================================== OUTPUT