m using ms access and c#
i fetch the data frm the database which includes sr.no. and store in a data table.
i thn display the contents using a datagridview.
everythin is working fine..
heres the catch
i do not want to display the sr.no...how can i make tht particular column invisible.
although i do not display the sr.no. i still require it during runtime..
babbu -12 Posting Whiz in Training
Recommended Answers
Jump to PostThere is a
Column.Visible
property, you should be able to set that to false. How you do that depends on how you are binding the data to the grid view.
Jump to PostTurn off AutoGenerateColumns property.
Take a look,
...... dataGridView1.AutoGenerateColumns = false; DataGridViewTextBoxColumn c1 = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn c2= new DataGridViewTextBoxColumn(); c1.HeaderText = "HeaderText_for_field1"; c2.HeaderText = "HeaderText_for_field2"; c1.DataPropertyName = "field1"; c2.DataPropertyName = "field2"; dataGridView1.Columns.Add(c1); dataGridView1.Columns.Add(c2); dataGridView1.DataSource = your_data_source; .....
Jump to PostChange the order of statements:
clientinfoCommandBuilder = new OleDbCommandBuilder(clientinfoDataAdapter); clientinfoDataAdapter.Fill(clientinfoDataTable);
All 10 Replies
privatevoid 24 Junior Poster in Training
kvprajapati 1,826 Posting Genius Team Colleague
towerrounder 5 Newbie Poster
chandru7 -1 Junior Poster in Training
babbu -12 Posting Whiz in Training
babbu -12 Posting Whiz in Training
kvprajapati 1,826 Posting Genius Team Colleague
babbu -12 Posting Whiz in Training
babbu -12 Posting Whiz in Training
babbu -12 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.