INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Extra Column In Data Bound DataGridView

Extra Column In Data Bound DataGridView

(OP)
In a previous posting (thread) I was creating a small datagridview (dgv) with one column from Active Directory. This time I am trying to use an existing data bound dgv and add a similar column to it. With the code below I am able to add the column, but no data is loaded into it. What am I missing?

CODE --> 2012

dgvCODView.DataSource = PWordRstTableAdapter.FillBySubmitted(Me.MedSARADataSet.PWordRst)
Dim extraColumn As New DataGridViewColumn
With extraColumn
     .Name = "UserName"
     .HeaderText = "User Name"
     .ReadOnly = True
End With
dgvCODView.Columns.Insert(0, extraColumn)

For Each row As DataGridViewRow In dgvCODView.Rows
     row.Cells("UserName") = GetUserName(domainDN, row.Cells("EmpID"))
Next 

RE: Extra Column In Data Bound DataGridView


Is there a reason you want to add the column to the DataGridView instead of the underlying DataTable?

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

RE: Extra Column In Data Bound DataGridView

(OP)
No, there is not a known reason for not using the underlying data table (PWordRstTableAdapter). I am new to programming and would like a better understanding about data tables, adapters, etc. This application will be used by several hundred people to submit requests for password resets. With this in mind, I will be creating several DGVs to display various pieces of information. I was hoping to find an efficient way to create views, some from the table, and some with additional columns. Can I add the column to the existing adapter and it won't affect another user looking at the same adapter in a different view?

RE: Extra Column In Data Bound DataGridView


If you add the extra column to the DataTable, it will only be part of that table. If you add a column to the adapter - in the SQL code - the yes, everyone will see that column. That's why I say add the column to the DataTable.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close