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;
- }

Jignesh KumarRank #91 · 22.9K reputationPosted May 27, 2019, 9:38 PM EDT
Jayakumar BalasubramaniamRank #267 · 9.5K reputationPosted May 26, 2019, 4:18 PM EDT
Ronika JencyRank #770 · 3K reputationPosted May 26, 2019, 8:37 PM EDT
https://www.dotnetcurry.com/ShowArticle.aspx?ID=155
Aniket RanaRank #1,690 · 902 reputationPosted May 26, 2019, 9:39 PM EDT
Oladotun Obileye86 reputationPosted May 27, 2019, 1:27 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted May 27, 2019, 9:16 PM EDT
Oladotun Obileye86 reputationPosted May 28, 2019, 12:52 AM EDT