473,414 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

ArrayList bound to DataGridView

Vic
I have a ArrayList bound to a DataGridView.
The objects in de arryalist have 5 propertie but i need only 3 of then in de
datagridview.
Cane somebody tell me how to prevent that some of the properties are not
show.

Best Regards
Vic
Nov 10 '08 #1
2 3922
On 2008-11-10, Vic <vs*******@telenet.bewrote:
I have a ArrayList bound to a DataGridView.
The objects in de arryalist have 5 propertie but i need only 3 of then in de
datagridview.
Cane somebody tell me how to prevent that some of the properties are not
show.

Best Regards
Vic

The only way I know is to turn AutGenerateColumns to false and then add the
columns you want:

myDataGridView.AutoGenerateColunns = False

Dim firstColumn As = new DataGridViewTextBoxColumn()
firstColumn.Name = "First Column"

' the name here is the name of the property of
' the object you want to be bound to this column
firstColumn.DataPropertyName = "MyProperty"

myDataGridView.Columns.Add(firstColumn)

' rinse and repeat until all columns are added.
HTH
--
Tom Shelton
Nov 10 '08 #2
Vic
Thx Tom for this.

Maybe a second question.
To bound a property to a column you indicate firstColumn.DataPropertyName =
"MyProperty"
Is this the only possibility? Isn't possible to use early binding?

Vic
"Tom Shelton" <to*********@comcastXXXXXXX.netschreef in bericht
news:ud****************@TK2MSFTNGP02.phx.gbl...
On 2008-11-10, Vic <vs*******@telenet.bewrote:
>I have a ArrayList bound to a DataGridView.
The objects in de arryalist have 5 propertie but i need only 3 of then in
de
datagridview.
Cane somebody tell me how to prevent that some of the properties are not
show.

Best Regards
Vic


The only way I know is to turn AutGenerateColumns to false and then add
the
columns you want:

myDataGridView.AutoGenerateColunns = False

Dim firstColumn As = new DataGridViewTextBoxColumn()
firstColumn.Name = "First Column"

' the name here is the name of the property of
' the object you want to be bound to this column
firstColumn.DataPropertyName = "MyProperty"

myDataGridView.Columns.Add(firstColumn)

' rinse and repeat until all columns are added.
HTH
--
Tom Shelton

Nov 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jax | last post by:
I have an arraylist of objects. This arraylist is bound to a repeater. That repeater then creates a set of controls like so <asp:repeater id="garmentRepeater" runat="server"...
3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
0
by: Dave | last post by:
Hi all, I have a listbox that is complex bound by an arraylist. The problem is that when I delete an object from the arraylist, the listbox does not reflect those changes. I tried refreshing...
0
by: Bob | last post by:
I have relational integrity set up in my sql server 2005 database that prevents cascading deletes in some cases. I'm using a bound datagrid view and a tablenavigator. When I click the delete...
0
by: Marcus Kwok | last post by:
I am having a weird problem with my DataGrid that is bound to an ArrayList. My situation is as follows: I have two DataGrids on a modal form. The top grid populates an ArrayList from a file,...
5
by: jjsavage | last post by:
Hi all, I've got a DataGridView bound to a DataTable, and I need to make some of the columns into ComboBoxColumns. I've tried some of the solutions listed here, but I can't seem to make them...
3
by: weird0 | last post by:
Purpose: The objective is to update or add a new row in datagridview using an arraylist I have an arraylist inside of a class and i added an object to the arraylist on the button click event....
4
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have a DataGridView bound to a collection of Custom Objects. I have enabled adding new rows, but since my object does not have a public constructor (it uses a factory method), I get an error...
0
by: mwcapps | last post by:
I have built an arraylist and have used it to fill an editable datagridview. Now I need to know if I can update the arraylist with whatever edits were made to the datagridview or if the edits need...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.