Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6616833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:37:51+00:00 2026-05-25T20:37:51+00:00

I have a form 1 with 2 datagrid view controls and tab control with

  • 0

I have a form 1 with 2 datagrid view controls and tab control with two tabs.

When I click on the datagridview cell I want to load something into two tabs.

First Tab

I want to display the selected datagridview row values in text boxes in first tab…. this was working fine….

Second tab

I want to populate the other datagridview in this tab depending on the selected row value (cell [0] value) in main the datagridview in form

But this is not working.

This is what I have done so far…

private void dgvCorporatedetails_CellClick(object sender, DataGridViewCellEventArgs e)
{
        textboxreadonly(false);
        btnAdd.Enabled = false;

        if (e.RowIndex >= 0)
        {
            int.TryParse(dgvCorporatedetails.Rows[e.RowIndex].Cells[0].Value.ToString(), out corporateid);
            if (corporateid > 0 && tccorporates.SelectedTab == tpDetails)
            {
                getselectedrecord(corporateid);

            }
            if (corporateid > 0 && tccorporates.SelectedTab == tpmembers)
            {

                Getmembersdetails(corporateid);

            }

        }

    }

It does not enter into this condition if (corporateid > 0 && tccorporates.SelectedTab == tpmembers)

even if I click on the datagridview cell and then I select the tab2(tpmembers) datagridview does not load in this tab page (tpmembers)

would any one pls help on this…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:37:52+00:00Added an answer on May 25, 2026 at 8:37 pm

    Place a breakpoint on that line then. Is corporateid greater than 0? Is the SelectedTab set to tpmembers? If your first if statement runs, indicating that the currently selected tab is tpDetails, then the second if statement will not run. Your if statements, as written, are mutually exclusive.

    The way you’ve got it now, if the user is on tab1 and selects a row in the grid, then only tab1 will show data regarding the selected row. If they want to view the data in tab2, they have to click on your grid again to load data into that tab. How about just loading all the data into both tabs at once, regardless of which one is currently selected?

    int corporateid;
    if (e.RowIndex >= 0 && int.TryParse(dgvCorporatedetails.Rows[e.RowIndex].Cells[0].Value.ToString(), out corporateid))
    {
        if (corporateid > 0)
        {
            getselectedrecord(corporateid);  // load data into tpdetails tab
            Getmembersdetails(corporateid);  // load data into tpmembers tab
        }
    }
    

    Just omit the tccorporates.SelectedTab == tpDetails and tccorporates.SelectedTab == tpmembers statements from your if blocks. When the user clicks on tab2, everything will already be loaded for them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a DataGridView and I want to load data from
In VB.net 3.5 SP1 I have a Windows Form with three DataGridView controls. One
I have form area in my view. If I click button A , I
I have a DatagridView control on a Windows form. It's selectionMode property is set
I have a form with a datagridview control on it. The datagridview is bound
On a Windows Form I have a DataGridView control with records that is filled
I have two DataGridView controls, with three buttons in between them vertically, in a
I have a windows form with a DataGridView control. I bound it into an
I have dynamically created DataGridView control on form, with DataSource specified as: ((DataGridView)createdControl).DataSource =
I have a form with a datagridview and when user start entering value for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.