Good day everyone, please i am trying to count the number of records of a datagridview(dtuserpro) in a usercontrol profile and pass it to a label in another usercontrol dashboard but i get no value.
- public partial class userprofile : UserControl
- {
- private string count1;
- public string Countt
- {
- get { return count1; }
- set { count1 = value; }
- }
- public userprofile()
- {
- InitializeComponent();
- }
- SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\odt\Documents\Loanapp.mdf;Integrated Security=True;Connect Timeout=30");
- DataTable dt = new DataTable();
- private void profile_Load(object sender, EventArgs e)
- {
- int count = ((DataTable)this.dtuserpro.DataSource).Rows.Count;
- lblcount.Text = count.ToString();
- Countt = lblcount.Text;
- }
- private void dashboard_Load(object sender, EventArgs e)
- {
- userprofile up = new userprofile();
- metroLabel1.Text = up.Countt;
- }