VideoCurso 27 VB.NET -Try y Catch - Capturar Errores


En este video tutorial veremos el uso de el try y catch que son funciones que nos permiten capturar errores y evitar de que nuestro programa se congele .

Video Tutorial

Codigo Fuente

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TRY -->INTENTAR 'CATCH-->CAPTURAR (ERROR) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try For i = 0 To ListBox1.Items.Count MsgBox(ListBox1.Items(i)) Next Catch ex As Exception MsgBox("Error detectado ! : " & ex.Message) End Try End Sub

Seguidores