.OnlineGuruji: vb-6.0

.OnlineGuruji

Provides E-Notes,Video Tutorials And Download Links For Students In hindi

*********************************************************

*********************************************************
********************************************************************************

Breaking

Ramchandicollege Saraipali

Technology Jobs

OnlineGuru Blog मे आपका स्वागत है ब्लॉग से संबन्धित जानकारी के लिए संपर्क करें मो ॰ नम ।-9826026747(सपन कुमार दास) अपने विषय से संबन्धित अपडेट प्राप्त करने के लिए ब्लॉग पे दिये गए Bell Icon को press करें कम्प्युटर,Science,English Grammer से संबन्धित विषय की अधिक जानकारी के लिए हमारे ब्लॉग अथवा यू ट्यूब चैनल को सब्क्राइब करे ..
Showing posts with label vb-6.0. Show all posts
Showing posts with label vb-6.0. Show all posts

Monday, June 8, 2020

June 08, 2020

Visual Basic Properties mathods and events or features

Visual Basic Properties mathods and events or features

Visual Basic

Visual Basic एक Event driven programming language है जिसके द्वारा Window आधारित application software का निर्माण किया जाता है। इस programming language का निर्माण नब्बे के दशक में Microsoft company ने किया था। जिसका प्रमुख उद्देश्य User को ग्राफिकल Environment Provide करना था। visual basic के पूर्व अधिकतर programming Language nongraphical होते थे जिसके द्वारा केवल DOS आधारित program ही create हो पाते जो User Friendly नहीं होते थे तथा इन्हें केवल वही user चला सकता था जिसे dos command याद हो। 
Visual (' विजुअल ') का अर्थ ऐसे तरिके से है जिसमे एक Application का user interface तैयार हो तथा उस application को user keyboard अथवा mouse के माध्यम से access करे तथा उस application का वातावरण पूर्णरूप से Graphical हो। यहां ' Basic ' एक programming language है जिसमें आप Programming सम्बन्धित Code type करते हैं। 
visual basic का use करके user automated, cusdom requard feature एवं predefined function का प्रयोग कर सकता है जिससे ऐसा application create होता है जिसमे create, modify text और compile करने की सभी सुविधा प्राप्त होती है।
visual basic high-level programming language है, जो users को निम्न features provide कराती है:
  1. Object oriented.
  2. Event driven.
  3. Auto completion Wizard.
  4. Error trapping tools.
  5. Flexible environment.
  6. Crystal & Data Reports.
  7. Help files.
  8. Clipboard & Printers.
  9. Database Connectivity.
  10. Wizards Facility.
  • Object Oriented - यहां object का अर्थ ऐसे control (tools) से है जिनकी कुछ विशेष properties तथा method होते हैं। इन properties को user के द्वारा programming language में objects मौजूद Events के द्वारा user programs के लिये user interface create करता है। Visual basic user को predefined objects तथा user defined object program में use करने की सहमति प्रदान करता है।
  • Event Driven - Event Driven का अर्थ यह है कि programing से सम्बन्धित Code तब तक activate नहीं होते हैं जब तक की user के द्वारा किसी event (Button procecing, menu selection) के respond में यह call न हो जाता हो। इसे हम दूसरे शब्दों में यह भी कह सकते हैं कि System के hardware जैसे mouse keyboard इत्यादि system के software के इस combination को हम event कहते हैं।
  • Automated Code Completion Wizard - इस सुविधा के अंतर्गत user के द्वारा code editer window में सम्बन्धित objects के लिए Coding करते समय उनसे related methods तथा properties की dropdown list code editor में Appear हो जाती है जिसे user उस list में मौजूद methods तथा objects को select करके स्वतः ही बिना type किये code editor window में attach कर सकता है।
  • Error Trapping Tools - इस सुविधा के द्वारा user program में runtime errors को find out करके programming में आसानी से debugging कर सकता है.
  • Flexible Environments - यह ऐसा वातावरण है जिसमें user अपनी इच्छा के अनुसार programme की coding upper case अथवा lower case में कर सकता है तथा अपनी इच्छा के अनुसार SDI forms (Single document interface) अथवा MDI forms (multiple document interface) का use कर सकता है।
  • Crystal & Data Reports - इस facility के माध्यम से user द्वारा inputed value तथा string का printer के माध्यम से report प्राप्त की जा सकती है जिसका इस्तेमाल बिलिंग इत्यादि में किया जाता है।
  • Help Files - Visual Basic language के साथ MSDN Help file provide होती है जिससे User आसानी से Help file का प्रयोग करके application तैयार कर सकता है।
  • Database Connectivity - (ODBC) Open database connectivity तथा ADO, DAO, RDO इत्यादि controls की सहायता से user स्वयं का database create कर सकता है तथा उन्हें विभिन्न database जैसे microsoft access, foxpro, oracles इत्यादि से data को connect कर सकता है।
  • Wizard Facility - इस सुविधा का use करके user data from wizard के द्वारा स्वयं का window based application create कर सकता है जिसमें window के सम्बन्धित सभी tools पहले से ही परिभाषित होते हैं। इसे वह programmer भी use कर सकता है जिसे programming सम्बन्धित अधिक जानकारी न हो।  
Created By :- Sapan Das

Friday, May 29, 2020

May 29, 2020

Looping Control Structure In VB6.0:- Sapan Das





Download Here   -Created By :- Sapan Das

Looping Control Structure

कंट्रोल स्ट्रक्चर का दूसरा भाग होता है looping structure इसकी आवश्यकता वहाँ  होती  है जहा किसी स्टेटमेंट को बार बार दोहराना होता है यह प्रोग्राम के किसी एक भाग को निश्चित समय तक दोहराता है यह कार्य तब तक बार बार होता रहता है  जब तक की दिया गया कंडिशन सत्य न हो जाए कंडिशन के false होने पर loop अपने आप ही समाप्त हो जाता है  और हम loop से बहार आ जाते है | प्रत्येक looping statement मे मुख्यतः तीन भाग होते| loop का स्टार्ट पॉइंट ,लूप का एंड पॉइंट और लूप का क्रम(incre /decre)

Types of looping statements

For –Next loop-  वीबी मे for loop मे for-next keyword का उपयोग होता है यहा for के साथ काउंटर variable को initilization किया जाता है तथा कंडिशन भी दिया जाता है यहा step keyword उपयोग कर लूप का ऑर्डर निर्धारित किया जाता है

और कंडिशन true होने पर body of loop execute होता है

Syntax

For var_name=(initialization) To var_name=(end point ) step 2

Statement

Next var_name

Example :-

Dim I As Integer

For I = 0 To 10

List1.AddItem (I)

Next I

Output :-











Private Sub Command2_Click()

Dim a As Integer

 For a = 2 To 20 Step 3 / 2 5 8 11 14 17 20

List1.AddItem ("Ramchandi College Saraipali")

       Next

End Sub 

उपरोक्त उदाहरण मे ramchandi college saraipali को 7 बार लिस्ट बॉक्स प्रिंट करेगा

Prog:- Write a prog to calculate the factorial number

Private Sub Command4_Click()

Dim i, f, num As Integer

f = 1

num = InputBox("Enter any Number")

For i = 1 To num

f = f * i

Next

MsgBox (f)

End Sub
















2-While –wend- इस लूप मे while wend keyword का उपयोग होता है इसमे काउंटर variable को initilize किया जाता है फिर while के साथ कंडिशन लगाया जाता है अगर कंडिशन true है तो body of loop execute होगा नहीं तो स्टॉप हो जाएगा

Syntax

Initilization

While (condition)

Body Of Loop

Incre/Decre

Wend

Example:

Dim I,j as integer

I=inputbox(“Enter Any Number”)===5

J= inputbox(“Enter Any Number”)---15

 

While i<=j

List1.add(i)

I=i+1

wend

 

Do while –Loop:- इस लूप मे do while loop  keyword का उपयोग होता है इसमे काउंटर variable को initilize किया जाता है फिर do -while के साथ कंडिशन लगाया जाता है अगर कंडिशन true है तो body of loop execute होगा नहीं तो स्टॉप हो जाएगा

Initilization

Do while condition

Body of loop

Incre/decr

Loop

Example:-

Dim x As Integer

x = o

Do While x <= 10

List1.AddItem (x)

x = x + 1

Loop

Do until –loop :- इस लूप मे do until loop  keyword का उपयोग होता है इसमे काउंटर variable को initilize किया जाता है फिर do until के साथ कंडिशन लगाया जाता है अगर कंडिशन false है तो body of loop execute होगा नहीं तो स्टॉप हो जाएगा यह लूप बाकी लूप से उल्टा चलता है

 

Syntax:-

Initialize variable

Do until condition

Statement

Incre/dec

Loop

I = 1

        Do Until I >= 11

            List1.AddItem (I)

            I = I + 2

        Loop

आउटपुट:-1 3 5 7 9

I = 11

        Do Until I >= 11

            List1.AddItem (I)

            I = I + 2

        Loop

 

आउटपुट:-no output (condition is true in first time )

Do...Loop While Statement

दो-लूप वाइल मे पहले स्टेटमेंट execute होता है उसके बाद कंडिशन चेक होता है अर्थात प्रत्येक बार स्टेटमेंट execute होता है फिर कंडिशन चेक होता है इस लूप मे कंडिशन true हो या false हो कम से कम एक बार तो स्टेटमेंट स्टेटमेंट ब्लॉक execute होगा ही  

Syntax:-

Initialization

Do

Statement

Incre/Decre

Loop while (condition)

Example :-

Dim number As Long

number = 6

Do

MsgBox (number)

number = number + 1

Loop While number < 5

The programs executes the statements between Do and Loop While structure in any case. Then it determines whether the counter is less than 5. If so, the program again executes the statements between Do and Loop While else exits the Loop.

For Each Next Loop :-

इस लूप का उपयोग किसी array अथवा collection मे प्रत्येक element के लिए group of statement को execute करने के लिए किया जाता है

Repeats a group of statements for each element in an array or collection.

For Each Next statements repeat a block of statements for each object in a collection or each element in an array.

Syntax

For Each element In group 
statements ] 
[ Exit For ] 
statements ] 
Next [ element ]
 

The For...Each...Next statement syntax has these parts:

उपरोक्त syntax मे element एक variant टाइप variable होता है जिसमे हम किसी object टाइप variable को assign करते है elelment की सहायता से ही हम किसी array अथवा collection के variable ko iterate करते है Group के अंतर्गत ayyay या collection होते hai statement optional होता है जिससे एक या एक से अधिक बार statement execute होता है

Goto statement :-

GoTo एक  unstructured control flow statement है यह code को less readable और maintainable बनाता है इसका उपयोग  Structured control flow statements जैसे  IfForWhile, आदि के स्थान पर कर सकते है

Example : -

Dim number As Integer

number = 3

        Dim sampleString As String

         If number = 1 Then GoTo Line1 Else GoTo Line2

Line1:

        sampleString = "Number equals 1"

        GoTo LastLine

Line2:

 sampleString = "Number equals 2"

LastLine:

Label1.Caption = sampleString







Wednesday, May 27, 2020

May 27, 2020

Control Structure-Conditional Statements-vb6.0

Control structure--

प्रत्येक prog lang मे program को नियंत्रित करने की सुविधा होती है |जिसके लिए एक विशेष प्रकार की स्ततेमेंट्स का उपयोग किया जाता है जो प्रोग्राम के flow of execution को नियंत्रित करत्| है वीबी मे इसके लिए कंट्रोल फ़्लो स्ततेमेंट्स का उपयोग किया जाता है कंट्रोल फलो स्ततेमेंट्स को मुख्यत दो भागो मे विभाजित किया गया है

1) 1- Conditional statements

2) 2- Looping statements     

Conditional statements के अंतर्गत निम्न स्ततेमेंट्स आते है

1)      If  Statement

2)      If  then  else Statement

3)      Nested  if  Statement

4)      Ladder else if Statement

5)      Select case Statement

 

1)If  Statement:-यह प्रोग्राम के फ्लो को सिर्फ एक ही डाइरैक्शन मे फ्लो करता है अर्थात if के साथ कंडिशन लगाया जाता है अगर if मे दिया गया कंडिशन सही होता है तभी प्रोग्राम का flow of execution होगा तथा if का स्टेटमेंट execute होगा | if के साथ end if का होना आवश्यक है

Syntax of If Statement

If(condition) then

Statement

End if

Example

Dim a As Integer

a = InputBox("Enter Any Number")

If a > 18 Then

MsgBox ("You are eligiable for vote")

End If

2)If  then else Statement:-यह प्रोग्राम के फ्लो को दोनों डाइरैक्शन मे फ्लो करता है अर्थात if के साथ कंडिशन लगाया जाता है अगर if मे दिया गया कंडिशन सही होता है तभी प्रोग्राम का flow of execution होगा तथा if का स्टेटमेंट execute होगा और अगर कंडिशन false होता है तो else block का स्टेटमेंट execute होता है| if के साथ end if का होना आवश्यक है

Syntax of If  then  else Statement

If(condition) then

Statement

Else

statement

End if

Prog:-Write a prog to check the person in india can vote or not using if else

Dim a As Integer

a = InputBox("Enter Any Number")

If a > =18 Then

MsgBox ("You are eligiable for vote")

Else

MsgBox ("You are not  eligiable for vote")

End If

Prog:-Write a prog to check enter number is even or odd using if else

Private Sub Command5_Click()

Dim num As Integer

num = Val(Text1.Text)

If num Mod 2 = 0 Then

Label2.Caption = "Enter  Number Is Even"

Else

Label2.Caption = "Enter  Number Is odd"

End If

Text1 = ""

Text1.SetFocus

End Sub

Output:-


1)  Nested  if  Statement:-जिस स्टेटमेंट मे प्रोग्राम के फ्लो   को कंट्रोल करने के लिए एक से अधिक if टतेमेंट का उपयोग होता है वह नेस्टेड  if else स्टेटमेंट कहलाता है इस स्टेटमेंट का कोई specific स्ट्रक्चर या syntax नहीं होता है

Syntax  of nested  If  then  else Statement

If(condition) then

     If(condition) then

              Statement

Else

              statement

End if

Else

     If(condition) then

           Statement

    Else

          statement

End if

Prog:-Write a prog to check the person in india can vote or not using bested if else

Private Sub Command6_Click()

Dim age As Integer

Dim name As String

Text2.Text = InputBox("Enter Age")

Text3.Text = InputBox("Enter name")

Dim x As Integer

Dim y As String

x = Val(Text2.text)

y = Text3.Text

If x >= 18 Then

If y = "india" Then

MsgBox ("You are eligiable")

Else

MsgBox ("You are Not eligiable")

End If

Else

MsgBox ("You are Not eligiable")

End If

Text2 = ""

Text3 = ""

 End Sub

Prog:-Find the greatest number between three number using nested if else

Dim a, b, c As Integer

a = InputBox("Enter First Number")

b = InputBox("Enter Second Number")

c = InputBox("Enter Third Number")

If a > b Then

If a > c Then

MsgBox ("a is big number")

Else

MsgBox ("c is big number")

End If

Else

If b > c Then

MsgBox ("b is big number")

Else

MsgBox ("c is big number")

End If

End If

1)      Ladder else if Statement:-इस स्टेटमेंट मे हम if तथा else के बीच कई elseif स्टेटमेंट का उपयोग कर कंडिशन चेक करा सकते है जिस if अथवा elseif मे दिया गया कंडिशन true पाया जाता है उस ब्लॉक का स्टेटमेंट एक्सेकुटे होता है अगर किसी भी elseif ब्लॉक का कंडिशन ट्रू न हो तो डिफ़ाल्ट   else ब्लॉक का स्टेटमेंट execute होता है इसमे number of elseif की संख्या निश्चित नहीं होती है यह प[रोगरम की आवश्यकता के अनुसार निश्चित किया जाता है

Syntax

If cond1 then

Statement1

Elseif cond2 then

Statement2

Elseif cond3 then

Statement3

Elseif cond-n then

Statement-n

Else

Default statement

End if

Example :-

प्रोग:-write a program to check the enter character is vowel or consonent

Private Sub Command2_Click()

Dim str As String

str = Text4.Text

If str = "a" Or str = "A" Then

MsgBox ("Enter Character is Vowel")

ElseIf str = "e" Or str = "E" Then

MsgBox ("Enter Character is Vowel ")

ElseIf str = "i" Or str = "I" Then

MsgBox ("Enter Character is Vowel ")

ElseIf str = "o" Or str = "O" Then

MsgBox ("Enter Character is Vowel ")

ElseIf str = "u" Or str = "U" Then

MsgBox ("Enter Character is Vowel ")

Else

MsgBox ("Enter Character is consonent")

End If

End Sub

Output:-


प्रोग:-write a program to check the enter number is negative positive or zero

 dim num As Integer

      num = Val(Text4.Text)

        If num > 0 Then

            MsgBox("Enter Number Is Positive")

            Text4.Text = ""

            Text4.setFocus

  ElseIf num = 0 Then

            MsgBox("Enter Number Is Zero")

             Text4.Text = ""

            Text4.setFocus

        Else

            MsgBox("Enter Number Is Negaive")

            Text4.Text = ""

            Text4.setFocus

        End If

    End Sub

प्रोग:-write a program to check profit and loss usin else if

Private Sub Button7_Click

        Dim pp, sp, ans As Integer

        pp = Val(Text5.Text)

        sp = Val(Text6.Text)

        If pp < sp Then

            ans = sp – pp

Label8.caption = "Profit of following anount " & ans

        ElseIf sp < pp Then

            ans = pp – sp

 Label8.caption = " Loss of following anount " & ans

        Else

     Label8.caption = " No profit No Loss “

        End If

    End Sub

1)      Select case Statement:- इस स्टेटमेंट का उपयोग भी elseif ladder स्टेटमेंट की तरह multilevel कंडिशन को चेक करने के लिए किया जाता है इसमे select के साथ expression को पास किया जाता है तथा अलग अलग case स्टेटमेंट मे दिये गए case value के साथ चेक किया जाता है जिस भी case value के साथ expression match करता है उसी case का स्टेटमेंट execute होता है इसमे number of case की संख्या निश्चित नहीं होती है यह प[रोगरम की आवश्यकता के अनुसार निश्चित किया जाता है select case end select के साथ close होता है तथा इसका डिफ़ाल्ट स्टेटमेंट case else होता है अर्थात किसी भी case वैल्यू के साथ अगर expression मैच न हो तो case else का block execute होता है

Syntax :-

 Select case (Expression)

Case (cond-1)

Statement-1

Case (cond-2)

Statement-2

Case (cond-3)

Statement-3

Case (cond-4)

Statement-4

   Case (cond-n)

Statement-n

Case else

Statement

End Select

Example :- write a program to check the enter character is vowel or consonent

Dim ans As String

        ans = Text5.Text

        Select Case (ans)

            Case "a"

  Label2.Caption = "Enter Character is vowel"

            Case Is = "e"

  Label2.Caption = "Enter Character is vowel"

            Case Is = "i"

  Label2.Caption = "Enter Character is vowel"

            Case Is = "o"

  Label2.Caption = "Enter Character is vowel"

            Case Is = "u"

  Label2.Caption = "Enter Character is vowel"

            Case Else

Label2.Caption = "Enter Character is consonenet"

        End Select

Output:-

Prog:- write a program to display the corresponding day between 0 to 6 using inputbox and msgbox function

Dim a As Integer

          a = InputBox("Enter Any Number")

        Select Case (a)

            Case Is = 1

                MsgBox ("Today Is Monday")

            Case Is = 2

                MsgBox ("Today Is Tuesday")

            Case Is = 3

                MsgBox ("Today Is Wednesday")

            Case Is = 4

                MsgBox ("Today Is Thursday")

 

  Case Is = 5

               MsgBox ("Today Is Friday")

            Case Is = 6

                MsgBox ("Today Is Saturday")

                Case Is = 6

                MsgBox ("Today Is Sunday")

            Case Else

               MsgBox ("Day Is Not Available")

        End Select