1 Attachment(s)
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.
Attachment 152255I then went back to the query and did the following:
Quote:
SELECT intChangeID, strName, strJobTitle, strDept
FROM tblChangeApprove
WHERE intChangeID = ?
Here is the code as it is run now:
Quote:
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:
Attachment 152255
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.
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.
1 Attachment(s)
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:
Quote:
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:
Attachment 152257
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.
Re: [RESOLVED] display DGV list from more than one table
Re: display DGV list from more than one table
Quote:
Originally Posted by
gwboolean
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.
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.