Hi
this code gives the error "Label1 is inaccessible due to its protection level" in the line in bold. How can i fix that?
Thanks
V
aspx file
<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="true" CodeBehind="tijden.aspx.cs" Inherits="tijdrit.Tijdrit" %>
...
...
code-behind
using System; using System.Web.UI;
namespace tijdrit
{
public partial class Tijdrit : Page
{
public names = "Bob";
}
class Test
{
protected void Page_Load(object sender, EventArgs e)
{
Tijdrit tr = new Tijdrit();
tr.Label1.Text = tr.names;
}
}
}
Valerie MeunierPosted Dec 30, 2022, 11:20 AM
Sorry, I found it. I have to go to the Designer.cs file and change protected in public.