Hey Guys,

I have a tabpage on my form, and I want to populate it according to which fields are set in a database. For example, I want tab#1 to list database fields of all items that have a particular field set to True. I want tab#2 to list the fields that do not have the key-field set to True. Could someone show me where to look for something like that? Thanks

I've attached a screenshot of my app - hopefully this will make it clearer. I have a field called "isCheckedOut". I just want to load the isCheckedOut=false items in the first tab.

Also, I want to have a link to a checkout page for each row that's displayed. I've created linklabels for now, but I want a way to have them tied to each item in the database. Any ideas?

I think I can modify my program to not need the link labels by adding a single "checkout" button - but how do I modify data entries in the database from there? E.g., When they click Checkout, I want the selected database entry to change isCheckedOut to true.

Hey Guys,

I have a tabpage on my form, and I want to populate it according to which fields are set in a database. For example, I want tab#1 to list database fields of all items that have a particular field set to True. I want tab#2 to list the fields that do not have the key-field set to True. Could someone show me where to look for something like that? Thanks

You need to handle SelectedIndexChanged event.

private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (tabControl1.SelectedIndex)
            {
                case 0: // 1st tab 
                    //code to populate data when 1st tab is selected.
                    break;
                case 1: //2nd tab
                    //code to populate data when 2nd tab is selected.
                    break;

            }
        }

Ok, thanks. How do I specify which data to show in the datagrid view? How do I make it check for a certain field in my database to be true before displaying the data?

I've got it figured out to a point. I've modified my SQL statement to grab the data I want - however, my tabChanged doesn't seem to be kicking in. Maybe I have something wrong?

private void tabControl_Assets_TabIndexChanged(object sender, EventArgs e)
        {
            switch (tabControl_Assets.SelectedIndex)
            {
                case 0:
                    // TODO: This line of code loads data into the 'reg_checkoutDataSet1.Laptops' table. You can move, or remove it, as needed.
                    this.laptopsTableAdapter.FillByCheckedIn(this.reg_checkoutDataSet1.Laptops);
                    break;
                case 1:
                    // TODO: This line of code loads data into the 'reg_checkoutDataSet1.Laptops' table. You can move, or remove it, as needed.
                    this.laptopsTableAdapter.FillByCheckedOut(this.reg_checkoutDataSet1.Laptops);
                    break;
            }
        }

Nothing shows up in my datagrid

For some reason it works when I add it to the click event?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.