1
My attempt below, is giving Object Reference, why? how to solve?
1
My attempt below, is giving Object Reference, why? how to solve?
1
Your problem is in the Page_Load
, because every time a postback is made its method of Page_Load
is called and is always recharging your data.
To avoid reloading data on PostBack
just doing that:
Protected Sub Page_Load(ByVal sender as Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
PreencheListaUsuarios()
PreencheListaPerfis()
End If
End Sub
That way when he gets on btnDeletarPerfil_click
listbox data will be normal. :)
Corretooo, vlw man!!!
@Wellitonmeneguim If you solved your problem, mark the answer as the solution. :)
0
If (lbPerfis.Items.Count = 0) = False Then
If (lbPerfis.SelectedItem Is Nothing) = False Then
roles.DeleteRole(lbPerfis.SelectedItem.Text.ToString)
End If
End If
-1
C# ////////////////////////////////
String value = Seu_listbox.Getitemtext(Seu_listbox .Selectedindex); //get index
String Value1 = Seu_listbox.Getitemtext(Seu_listbox.Text ); //get Text
Messagebox.Show(Value);
Messagebox.Show(Valor1);
VB.Net ///////////////////////////////////////
Dim Value As String = Seu_listbox.Getitemtext(Seu_listbox.Selectedindex)
Dim Valor1 As String = Seu_listbox.Getitemtext(Seu_listbox.Text)
Messagebox.Show(Value)
Messagebox.Show(Valor1)
Browser other questions tagged vb.net
You are not signed in. Login or sign up in order to post.
I am selecting yes! To popular I did the following: lbPerfis.Datasource = Roles.Getallroles() lbPerfis.Databind()
– WellDotCom