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:
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
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:
Code:
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