Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27248

VS 2012 VB Error Handler Event

$
0
0
Code:

Public Sub jogo_abrir(ByVal sender As Object, ByVal e As EventArgs)
        Dim nome As String = "a"

        MsgBox(nome)

    End Sub


    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim saves(), paths, nome As String
        Dim data_save As Date
        Dim i As Integer = 1
        Dim y_panel As Integer

        saves = System.IO.Directory.GetDirectories("..\..\Saves")

        For Each paths In saves
            data_save = System.IO.Directory.GetLastWriteTime(paths)
            Dim lb_jogos As New Label
            Dim lb_data As New Label
            Dim pb_jogos As New Panel

            nome = paths.Replace("..\..\Saves\", "")
            pb_jogos.Name = "pb_save" & i

            lb_jogos.Name = "lb_nome"
            lb_jogos.Text = "Nick.: " & nome
            lb_jogos.TextAlign = ContentAlignment.MiddleCenter
            lb_jogos.Width = 380
            lb_jogos.Location = New Point(lb_jogos.Location.X, 2)

            lb_data.Name = "lb_data"
            lb_data.Text = "Jogo guardado em: " & data_save
            lb_data.TextAlign = ContentAlignment.MiddleCenter
            lb_data.Width = 380
            lb_data.Location = New Point(lb_data.Location.X, 24)

            pb_jogos.Size = New Size(380, 50)
            pb_jogos.BorderStyle = BorderStyle.FixedSingle
            pb_jogos.Location = New Point(0, y_panel)
            pb_jogos.Cursor = Cursors.Hand

            painel_guardardos.Controls.Add(pb_jogos)
            pb_jogos.Controls.Add(lb_jogos)
            pb_jogos.Controls.Add(lb_data)

            AddHandler pb_jogos.Click, AddressOf jogo_abrir

            i = i + 1
            y_panel = y_panel + 51
        Next
End Sub


The pb_jogos which is a panel that will be created automatically, should be addressed to the click event for the sub jogo_abrir, but the same is not true and I wonder why it happened.

greetings
Ricardo Pereira

Viewing all articles
Browse latest Browse all 27248

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>