Page 2 of 2 FirstFirst 12
Results 41 to 47 of 47

Thread: [RESOLVED] display DGV list from more than one table

  1. #41

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Re: display DGV list from more than one table

    I understand that, I think. I had the Data bound set in the DGV Task Window. However, I got rid of that and put that into the code instead........

    Whoa!!!! I just looked again in the DGV task Window and the Data Bound property was indeed set to the dataset. So I did several things. In the Task Window I changed the Data Bound setting to None, and disposed of all of the columns I had added there.
    Name:  DGV.jpg
Views: 222
Size:  18.7 KBI then went back to the query and did the following:

    SELECT intChangeID, strName, strJobTitle, strDept
    FROM tblChangeApprove
    WHERE intChangeID = ?
    Here is the code as it is run now:

    Private Sub SubSignList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.TblChangeApproveTableAdapter.FillByChangeID(Me._MasterBase4_0ItemMasterDataSet.tblChangeApprove, glbintCRNum)
    dgvSignList.DataSource = Me._MasterBase4_0ItemMasterDataSet
    dgvSignList.DataMember = "TblChangeApprove"
    dgvSignList.Columns(1).HeaderText = "Change ID"
    dgvSignList.Columns(2).HeaderText = "Name"
    dgvSignList.Columns(3).HeaderText = "Job Title"
    dgvSignList.Columns(4).HeaderText = "Department"
    End Sub
    And here is the results as run in the application:

    Name:  DGV.jpg
Views: 222
Size:  18.7 KB

    As can be seen, the data are all there and in the right place. The only remaining issue is why are the other fields showing. I have an idea I am going to try on that. Let me know what you see that needs to be done to finish this thorny issue.

  2. #42
    Hyperactive Member Mike Storm's Avatar
    Join Date
    Jun 2017
    Location
    Belgium
    Posts
    425

    Re: display DGV list from more than one table

    That query wont work, you will need to create a new one for this propose, you using a tableadapter that has another Fill methode that contains the entire table, or you hide the columns setting the visible property to false.
    the rest, you have the code samples i left you before.

  3. #43

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Re: display DGV list from more than one table

    OK, I have it all now. And I really thank you man for helping me through this.

    1. In the DGV Task window (or properties window if you prefer). The Data Bound property must be set to (None). This turned out to be very, very important.
    2. In the DGV task window you do not want to have any columns showing.
    3. In the query it makes no difference whether the SELECT command has just the columns of interest or all of them.
    4. The code should be as follows:

    Private Sub SubSignList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.TblChangeApproveTableAdapter.FillByChangeID(Me._MasterBase4_0ItemMasterDataSet.tblChangeApprove, glbintCRNum)
    dgvSignList.DataSource = Me._MasterBase4_0ItemMasterDataSet
    dgvSignList.DataMember = "TblChangeApprove"
    dgvSignList.Columns(0).Visible = False
    dgvSignList.Columns(1).HeaderText = "Change ID"
    dgvSignList.Columns(1).Width = 100
    dgvSignList.Columns(2).HeaderText = "Name"
    dgvSignList.Columns(2).Width = 275
    dgvSignList.Columns(3).HeaderText = "Job Title"
    dgvSignList.Columns(3).Width = 275
    dgvSignList.Columns(4).HeaderText = "Department"
    dgvSignList.Columns(4).Width = 200
    dgvSignList.Columns(5).Visible = False
    dgvSignList.Columns(6).Visible = False
    dgvSignList.Columns(7).Visible = False
    dgvSignList.Columns(8).Visible = False
    dgvSignList.Columns(9).Visible = False
    End Sub
    And here is the final result:

    Name:  DGV.jpg
Views: 280
Size:  16.8 KB

  4. #44

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Re: display DGV list from more than one table

    Oh, I went back to the original filter query that I was wanting to use. Again, it makes no difference how many columns you include in the SELECT command, as long as it includes the ones of interest.

    Again, I really appreciate your helping me with this. You provided everything that was required and all I had to figure out is where I was going wrong. This definitely gets the job done.

  5. #45
    Hyperactive Member Mike Storm's Avatar
    Join Date
    Jun 2017
    Location
    Belgium
    Posts
    425

    Re: [RESOLVED] display DGV list from more than one table

    You welcome.

  6. #46
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: display DGV list from more than one table

    Quote Originally Posted by gwboolean View Post
    By the way Mike, I really appreciate the time you are putting in on this. Even though I do not yet have what I am after this is helping my understanding a whole lot.
    On a side note I see you are in Oregon City, I'm in Salem.

  7. #47

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    705

    Re: display DGV list from more than one table

    Karen,

    Actually, I now live in The Couv (Vancouver). When I was getting ready to move from The OC though I did just a little looking in Salem. I really like it there and there were some really good deals on some really fine homes there. So I can assume you are pleased living there. The fact that you too are an Oregonian just moved you way, way up in my esteem. By the way, you seem to really get around these forums a lot.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width