Shaitan00 Posted October 2, 2006 Posted October 2, 2006 Given a DataGridView (dgvPlayerList) used to display all the players and their current information to the user. Given a DataSet (dsPlayerList.Tables["PlayerList"]) that house the list of players and their information to be displayed as the datasource of the datagridview (dgvPlayerList)... The DataTable (PlayerList) is composed of 4 columns: [iD], [Name], [Type], [iP]. Currently I am using the following code to display the information: dgvPlayerList.DataSource = dsPlayerList.Tables["PlayerList"]; Problem is this displays all 4 columns and I do not want to shown the [iD] or [iP] columns in the datagridview - so I tried to customize the coloumns collection by creating the [Name] and [Type] columns and setting "dgvPlayerList.AutoGenerateColumns = false;" but when I try the columns are never filled with data ... It seems I need a way to map the datagridview column with its corresponding column in the DataSet.Tables["PlayerList"], I did some reading and people mentioned the DataMember & ValueMember field but little to no examples where provided and I couldn't get it to work. Others spoke of the DataPropertyName but again little to no examples or samples... So I was hopeing someone could help shed some light on my little problem - I just want to MAP (somehow) my columns in the datagridview column collection with a specific column in the datasource datatable column... Any ideas, hints, and help would be greatly appreciated, thanks Quote
Kenkthulhu Posted April 24, 2007 Posted April 24, 2007 the date says this was posted four years ago - let me know if you still need help with this. Quote
auxcom Posted April 29, 2007 Posted April 29, 2007 the date says this was posted four years ago - let me know if you still need help with this. I hope you can share your solution to this. I also need this. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.