Hi,
I am filling a datagridview with multiple columns from my oracle database.
It has become necessary that I add a column with a checkbox.
I figured this out.

Dim cbPart As New DataGridViewCheckBoxColumn
                DataGridView1.Columns.Insert(1, cbPart)

                With cbPart
                    .HeaderText = "PART"
                    .Name = "Part"
                    .DisplayIndex = 0
                    .Frozen = True

My column is showing up just fine.
I have a column filled with alphanumeric part numbers for example a154-321-2
I would like to flag a checkbox whenever a part number has a certain format. Such as all formats that contain a154 then check a box.

Can anyone give me a good starting point for this. I am unsure of where to begin.
Thanks

You have two options:
first: you can create a extra column in your query to return true or false if your part No start with your criteria, then bound that to the checkboxcolumn.

Second: you have to use the DataGrid.OnItemDataBound Method here is an example then with in that method you will have to compare your format with the part being bound in the datagrid and then check or not your checkbox column.

Thanks for your advice. I'm going to start by attempting to use it within my query. Do you know which method causes less overhead?

The first one.

OK, I'll run with that for now. Thanks!

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.