Posts

Showing posts from June, 2022

VB Format Text

Image
 FORMAT TEXT :- CODE IS HERE:- Private Sub optBlue_Click()     lblMessage.ForeColor = vbBlue End Sub ----------------------------------------------------------------------- Private Sub optGreen_Click()     lblMessage.ForeColor = vbGreen End Sub ----------------------------------------------------------------------- Private Sub Option1_Click() Label1.ForeColor = vbGreen End Sub ----------------------------------------------------------------------- Private Sub optLarge_Click()     lblMessage.FontSize = 22 End Sub ----------------------------------------------------------------------- Private Sub optMedium_Click()     lblMessage.FontSize = 16 End Sub ----------------------------------------------------------------------- Private Sub optRed_Click()     lblMessage.ForeColor = vbRed End Sub ----------------------------------------------------------------------- Private Sub optSmall_Click()     lblMessage.FontSize = 12 End Sub -----------------------------------------------------------------

vb example form design

Image
 FORM DESIGN -  CODE VIEW - Private Sub cmdBlack_Click()     Form1.BackColor = vbBlack              'THIS PROGRAM TEACHES YOU TO SET PROPERTIES IN RUN-TIME                                         'Form1 is the OBJECT, BackColor is the PROPERTY, vbBlack is VALUE End Sub Private Sub cmdChangePosition_Click()     Form1.Top = 5000     Form1.Left = 5000 End Sub Private Sub cmdDefault_Click()     Form1.BackColor = &H8000000F         'This is the Hexa-decimal color code     Form1.Width = 4500     Form1.Height = 4125     Form1.Top = 900                     'You can also set these properties in DESIGN TIME     Form1.Left = 900 End Sub Private Sub cmdEnlarge_Click()     Form1.Width = 5160     Form1.Height = 4770 End Sub Private Sub cmdGreen_Click()     Form1.BackColor = vbGreen                 'vbGreen is a VB CONSTANT End Sub Private Sub cmdMakeSmaller_Click()     Form1.Width = 4500     Form1.Height = 4125 End Sub Private Sub cmdRed_Click()     Form1.BackColor = vbRed En

vb example digi clock

Image
 DIGITAL CLOCK    CODE VIEW - Private Sub cmdPause_Click()     Timer1.Enabled = False End Sub Private Sub cmdStart_Click()     Timer1.Enabled = True End Sub Private Sub Timer1_Timer()     txtTime.Text = Time End Sub

vb example color picker from form

Image
 COLOR PICK FROM FORM CODE VIEW - Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)     If Button = vbRightButton Then         PopupMenu mnuColors     End If End Sub Private Sub mnuBlue_Click()     Form1.BackColor = vbBlue End Sub Private Sub mnuGreen_Click()     Form1.BackColor = vbGreen End Sub Private Sub mnuRed_Click()     Form1.BackColor = vbRed End Sub Private Sub mnuWhite_Click()     Form1.BackColor = vbWhite End Sub Private Sub mnuYellow_Click()     Form1.BackColor = vbYellow End Sub

vb example click count

Image
 CLICK COUNT CODE IS HERE :- Private Sub cmdClick_Click()     Static n As Integer     n = n + 1     Print n End Sub

vb simple program

Image
 VB PROGRAM MICROSOFT VISUAL BASIC write a program to print the multiplication table- Dim I, j As Integer Private Sub command1_click() For I = 1 To 10 For j = 1 To 10 p = I * j Print I; "*"; j; "="; p, Next j Print Next I End Sub Write a program to find the summation of undetermined number of positive numbers such that the program will be stopped when we enter negative  number- Dim x, sum As Single Private Sub command1_click() sum = 0 x = Val(InputBox("enter x", "summation")) Do While x >= 0 sum = sum + x x = Val(InputBox("enter x", "summation ")) Loop MsgBox (CStr(sum)) End Sub