.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Object reference not set to an instance of an object (part 3)

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

Object reference not set to an instance of an object (part 3)

StackTrace Property


The use of the function catch in the function try is very important. It is so important because it allows the programmer to build programs faster. From my humble opinion, I've always found that too many programmers neglect error handling in their conceptions of computer code. The result is that development times are longer and of lower quality. Employers who submit projects must impose basic techniques for handling errors. Because time is money.

Today, I took the opportunity to change the function catch easily. This change will allow the programmer to better identify and quickly correct errors or stops programs. We will use the StackTrace property. Watch the following code:

''' <summary>
''' crash test and how to improve your coding
''' </summary>
''' <remarks></remarks>
Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    End Sub
    ''' <summary>
    ''' pressing button1 will crash he program
    ''' this crash is the typical crashing type for all beginners
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim aString() As String 'declare and array only


        Try
            'a crash will occur and the code won't be able to handle it
            MsgBox(aString(0)) ' you do something with the array and and array is nothing

        Catch ex As Exception
            MsgBox(ex.StackTrace) 'add basic error message here
        End Try

       
    End Sub
End Class


Others will write a custom phrase in the Msgbox. For example: "Error in function displays the table, please contact your Mr. XYZ."
In the two cases cited as an example, you will find cumbersome to identify where the error occurred. This is why the StackTrace property displays the function and the line of code where the error occurred.

When generating the error, the error message becomes much more explicit. (See image)
We immediately see the file, the function and the line of code where the error occurred.
So, you could line the line and directly infer the causes of the error message. Ends managements error complicated and customized for each of your many functions.
Eventually the error messages that mean nothing:

About

I invite you to visit my blog for more articles and leave a comment.
Check Technologies represents more than 10 years .... In computing technology and computer aided design.






Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel Object reference not set to an instance of an object (part 3), Diterbitkan oleh scodeaplikasi pada Minggu, 14 Oktober 2012. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to