In Visual Basic (VB), "End Sub" is a statement used to indicate the conclusion of a subroutine. A subroutine, defined using the "Sub" keyword, is a block of code that performs a specific task but does not return a value. The "End Sub" statement signifies the end of that block, allowing the program to know where the subroutine finishes. It is essential for structuring the code correctly and ensuring proper execution flow.
A procedure is a group of executable statements wrapped between a declaration statement and a matching End statement, the following are examples of valid VB procedures: Sub Function Event Handler Property Procedures Operation Procedures Generic Procedures E.g Private Sub ExampleProcedure() <Code> End Sub
form1.vb
Private Sub search_Click() On Error GoTo donothing a = InputBox("enter the name") s1 = ("name='" & Trim(a) & "'") rs.Findfirst (s1) If .nomatch Then MsgBox "record not found" Else MsgBox "record found" Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) End If Exit Sub donothing: MsgBox "error description" End Sub
you can get lots of source code from 1000projects.com in diff languages....
In Visual Basic (VB), a procedure is a block of code that performs a specific task and can be executed when called. Procedures can be categorized into two main types: Sub procedures, which do not return a value, and Function procedures, which return a value. They help organize code, promote reusability, and improve readability by encapsulating functionality into manageable units. Procedures can accept parameters, allowing for flexible input and processing.
A procedure is a group of executable statements wrapped between a declaration statement and a matching End statement, the following are examples of valid VB procedures: Sub Function Event Handler Property Procedures Operation Procedures Generic Procedures E.g Private Sub ExampleProcedure() <Code> End Sub
Private Sub Command1_Click() string1 = Text1.Text string2 = StrReverse(string1) result = StrComp(string1, string2, vbTextCompare) If result = 0 Then MsgBox string2 & " is a palindrome..." Else MsgBox string1 & " is not a palindrome..." End If End Sub
MsgBox "You done it", 16, "Well done!" Make sure that this code is followed up by something, e.g. if you have a text box and you require a user to out an answer in it, your code should be something like: If textbox1.text = "Answer" Then Msgbox "You done it", 16, "Well done!" End If End Sub
Private Sub Command1_Click() Dim I, N As Integer N = Val(Text1.Text) For I = 2 To N - 1 If N Mod I = 0 Then Print "THE NUMBER IS NOT A PRIME NUMBER" Exit Sub End If Next I Print "THE NUMBER IS A PRIME NUMBER" End Sub Private Sub Command2_Click() Text1.Text = "" Text1.SetFocus End Sub Private Sub Command3_Click() End End Sub
form1.vb
vvbvcvbn vb
Private Sub search_Click() On Error GoTo donothing a = InputBox("enter the name") s1 = ("name='" & Trim(a) & "'") rs.Findfirst (s1) If .nomatch Then MsgBox "record not found" Else MsgBox "record found" Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) End If Exit Sub donothing: MsgBox "error description" End Sub
Private Sub Workbook_Open() Worksheets(1).Activate End Sub In VB worksheet
VB is basically a programming language. For keeping records, generally we use a database like Oracle, MS ACCESS, etc. dedicatedly to store data. These databases are not good enough to code a program to develop software. Hence we need to develop software where VB is used for the programming part and database is used for the data storage part. Thus VB makes a bridge between user and database. The database cannot be directly accessed by the user but through VB. Hence the database is the back-end tool and VB is a front end-tool.
Private Sub cmdcm_Click() txtin.Text = val(txtcm.Text) * 0.393700787 End Sub ________________________________________________________________ Private Sub cmdin_Click() txtcm.Text = val(txtin.Text) * 2.54 End Sub
wrtrwtgfe
'For the Exit confirmation If MsgBox("Sure to Exit?", vbInformation + MsgBoxStyle.YesNo) = vbNo Then Exit Sub End If Me.Close() '-------------------------------------------------------------------------- 'For the other confirmation(2 events) If Text1.Text = "" Then MsgBox("there is not any serial to be Copied!!", MsgBoxStyle.MsgBoxRtlReading) Else : MsgBox("serial Copied Sucs") End If 'Then write ur code