google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.

Monday, February 23, 2015

Write a Visual Basic program to implement the find and replace dialogue box for text-box

Design an application in Visual Basic to implement the find and replace dialogue box for text-box control with multiple line of text with 3 option buttons and check boxes

Design window of form:-

Code:-
Dim txt As String
Dim s, l, r As Integer
Private Sub Check1_Click(Index As Integer)
    If Check1(0).Value = 1 Then
        Text1.Font.Bold = True
    Else
        Text1.Font.Bold = False
    End If
    If Check1(1).Value = 1 Then
        Text1.Font.Italic = True
    Else
        Text1.Font.Italic = False
    End If
    If Check1(2).Value = 1 Then
        Text1.Font.Underline = True
    Else
        Text1.Font.Underline = False
    End If
End Sub

Private Sub cmdClear_Click()
Option1(0).Value = False
Option2(1).Value = False
Option3(2).Value = False

Check1(0).Value = 0
Check2(1).Value = 0
Check3(2).Value = 0
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdFind_Click()
txt = InputBox("enter Text to find")
l = Len(txt)
r = InStr(1, Text1.Text, txt, vbTextCompare)
Text1.SelStart = r - 1
Text1.SelLength = l
End Sub

Private Sub cmdFindNext_Click()
If r <> Len(Text1.Text) Then
    r = InStr(r + 1, Text1.Text, txt, vbTextCompare)
    Text1.SelStart = r - 1
    Text1.SelLength = l
Else
    MsgBox "No more Text", vbInformation, "Find"
End If
End Sub

Private Sub cmdReplace_Click()
txt1 = InputBox("Enter text to replace")
Text1.Text = Replace(Text1.Text, txt, txt1)

End Sub

Private Sub Form_Load()
Text1.Text = "Design an application in VB to implement the find and replace dialogue " & _
            "box for textbox control with multiple line of text with 3 option buttons and check boxes and"
End Sub

Private Sub Option1_Click(Index As Integer)
If Option1(0).Value = True Then
    Text1.Font.Name = "Arial"
ElseIf Option1(1).Value = True Then
    Text1.Font.Name = "Arial Black"
Else
    Text1.Font.Name = "Times New Roman"
End If
End Sub


=================================================
OUTPUT


Write a Visual Basic Program to make customer Survey and with their name and then display the survey result.

Write a Visual Basic Program to make customer Survey and  with their name and then display the survey result.
------------------------------------------------------------------------------------------
Design Window:-
 First Form :-

Second form:-

Code;-
Dim Excellent As Integer
Dim Satisfactory As Integer
Dim Average As Integer
Dim Bad As Integer
Dim Total As Integer

Private Sub cmdContinue_Click()
If optExcellent.Value Then
    Excellent = Excellent + 1
ElseIf optSatisfactory.Value Then
    Satisfactory = Satisfactory + 1
ElseIf optAverage.Value Then
    Average = Average + 1
Else
    Bad = Bad + 1
End If
txtName.Text = ""
optExcellent.Value = False
optSatisfactory.Value = False
optAverage.Value = False
optBad.Value = False
txtName.SetFocus
End Sub

Private Sub cmdQuit_Click()
Total = Excellent + Satisfactory + Average + Bad
With frmServeyResult
    .lblExcellent = Excellent
    .lblSatisfactory = Satisfactory
    .lblAverage = Average
    .lblBad = Bad
    .lblExcellentPer = Format((Excellent / Total) * 100, "#0.00")
    .lblSatisfactoryPer = Format((Satisfactory / Total) * 100, "#0.00")
    .lblAveragePer = Format((Average / Total) * 100, "#0.00")
    .lblBadPer = Format((Bad / Total) * 100, "#0.00")
End With
frmServeyResult.Show
Unload Me
End Sub

========================================
OUTPUT
After entry of six customers response of first form survey result is:-



अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...