VB.net | Exception Handling | Error Handling | Bugs | Try | Catch | Throw | Finally
Vb.net | Exception Handling | Error & Bugs | Try | Catch | Throw | Finally | Hindi | Urdu
इस लैक्चर में न केवल एक्सेप्शन बल्कि एरर और बग्स को भी समझाया गया है
Notes
=========
Exception एक समस्या है जो एक कार्यक्रम के output के दौरान उत्पन्न होती है।
एक Exception एक असाधारण परिस्थिति की प्रतिक्रिया है जो किसी कार्यक्रम को चलाने के दौरान उत्पन्न होती है, जैसे कि शून्य से विभाजित करने का प्रयास।
Exception प्रोग्राम के एक भाग से दूसरे में नियंत्रण स्थानांतरित करने का एक तरीका प्रदान करते हैं। VB.Net Exception हैंडलिंग चार कीवर्ड - Try, Catch, Finally and Throw पर बनाया गया है।
Try - एक try ब्लॉक कोड के एक ब्लॉक की पहचान करता है जिसके लिए विशेष Exception active हो जाएंगे। इसके बाद एक या अधिक Catch ब्लॉक आते हैं।
Catch - एक प्रोग्राम एक Exception हैंडलर के साथ एक Exception को एक कार्यक्रम में उस स्थान पर पकड़ता है जहां आप समस्या को संभालना चाहते हैं। कैच कीवर्ड Exception को पकड़ने का संकेत देता है।
Finally - Finally ब्लॉक का उपयोग दिए गए कथनों के सेट को execute करने के लिए किया जाता है, चाहे कोई Exception Throw किया जाए या नहीं। उदाहरण के लिए, यदि आप कोई फ़ाइल खोलते हैं, तो उसे बंद कर दिया जाना चाहिए, चाहे कोई Exception raise किया गया हो या नहीं।
Throw - एक program एक Exception को फेंकता है जब एक problem दिखाई देती है। यह एक थ्रो कीवर्ड का उपयोग करके किया जाता है।
System.IO.IOException Handles I/O errors.
System.IndexOutOfRangeException Handles errors generated when a method refers to an array index out of range.
System.ArrayTypeMismatchException Handles errors generated when type is mismatched with the array type.
System.NullReferenceException Handles errors generated from deferencing a null object.
System.DivideByZeroException Handles errors generated from dividing a dividend with zero.
System.InvalidCastException Handles errors generated during typecasting.
System.OutOfMemoryException Handles errors generated from insufficient free memory.
System.StackOverflowException Handles errors generated from stack overflow.
Try
[ tryStatements ]
[ Exit Try ]
[ Catch [ exception [ As type ] ] [ When expression ]
[ catchStatements ]
[ Exit Try ] ]
[ Catch ... ]
[ Finally
[ finallyStatements ] ]
End Try
Example
Module exception
Dim a As Integer
Dim b As Integer
Dim res As Integer
Sub main()
a = Console.ReadLine()
b = Console.ReadLine()
Try
res = a \ b
Catch e As DivideByZeroException
Console.WriteLine(e.Message)
Finally
Console.WriteLine("res=" & res)
Console.ReadLine()
End Try
End Sub
End Module
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
{आप सभी से मेरा अनुरोध है, किसी भी विषय पर आपको यदि कोई भी सुझाव देना हो, सवाल करने हो तो कृपया उस विडियो के नीचे कमेंट कर दे। You are all requested to post comment if you any doubt, suggestion or question}
{यह चैनल लगभग सभी विश्वविद्यालय के कम्प्युटर साइन्स के विषयों के पाठ्यक्रम को कवर करता है। मुख्यतः पंडित रविशंकर शुक्ल विश्वविद्यालय, छत्तीसगढ़ और माखन लाल राष्ट्रीय पत्रकारिता विश्वविद्यालय, इसके अलावा इस चैनल में कम्प्युटर तकनीकी संबंधी विडियोस भी उपलब्ध हैं।}
चैनल की सभी प्लेलिस्ट देखने के लिए यहाँ क्लिक करें –
https://www.youtube.com/user/AtharDhamtari/playlists
Google Blogs:- athardhamtari.blogspot.com
Instagram - https://www.instagram.com/hashmi_athar/
Linkedin Profile - https://www.linkedin.com/in/sayed-athar-ali-hashmi-7346211a/
Twitter Account - https://twitter.com/ProfessorAthar
Facebook Page - https://www.facebook.com/ProfessorHashmi/
Youtube Channel Page - https://www.youtube.com/user/AtharDhamtari/
Other playlist that were recorded by me: मेरे द्वारा पढ़ाये गए अन्य विषयों की प्लेलिस्ट
चैनल लिंक
https://www.youtube.com/user/AtharDhamtari/
विषयवार प्लेलिस्ट
*Fundamental*
Fundamental of Computer System – https://bit.ly/39HTR3l
Computer Organization and Architecture - https://bit.ly/2Rd8rcD
Application Softwares
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Office Automation | आफिस ऑटोमेशन Hindi| Urdu - https://bit.ly/2X9iJOR
Database Management Using MS Access 2007 डेटाबेस एम एस एक्सैस 2007 - https://bit.ly/2JHwqMW
Spreadsheet using Microsoft Excel स्प्रैडशीट माइक्रोसॉफ़्ट एक्सेल - https://bit.ly/2wiW1sG
Web Technology
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
HTML In 7 Lectures - https://bit.ly/3dTymjm
JavaScript जावास्क्रिप्ट - https://bit.ly/39JTVzN
Programming and Software Development
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
VB.NET वीबी.नेट – https://bit.ly/34an4CU
Java Programming - https://bit.ly/2xOSu5P
Python Programming - https://bit.ly/3aVv2SM
Object Oriented Programming OOPS and C++ - https://bit.ly/39IP3uv
Programming in C सी प्रोग्राममिंग हिन्दी में (Hindi/Urdu) - https://bit.ly/2JHe0vK
Data Structure Through C Lanuguage - https://bit.ly/2VkpdJu