473,382 Members | 1,368 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,382 software developers and data experts.

Datagrid - Windows Application

Hello guys

I`m developing a windows form that contain one Datagrid.
In this datagrid I insert a checkBox Column. I need to get
all rows where checkbox is checked by user.
How do I get this rows ?
I canīt use the DataSource of Datagrid because I donīt
have a Column source for checkBox in my DataSource.
Is there any method in datagrid to loop in datagrid rows ?

Tks a lot.

Jean Carlo Mendes
Nov 15 '05 #1
5 2615
Jean,

How do you have a column binding without a datasource? I would think
that you have to have an underlying column to bind to.

Regardless, what you could do is get the value using the Item property
(the indexer) of the data grid. This will give you the value at a
particular row and column.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jean Carlo" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
Hello guys

I`m developing a windows form that contain one Datagrid.
In this datagrid I insert a checkBox Column. I need to get
all rows where checkbox is checked by user.
How do I get this rows ?
I canīt use the DataSource of Datagrid because I donīt
have a Column source for checkBox in my DataSource.
Is there any method in datagrid to loop in datagrid rows ?

Tks a lot.

Jean Carlo Mendes
Nov 15 '05 #2
Hi Nicholas
I have a column in my dataSource but I need to get only
rows checked by user in interface.
We donīt have an "Item" property in DataGrid... itīs my
problem...
What means "the indexer" of DataGrid ... I canīt see this
property.

Tks for your reply

[]s

Jean
-----Original Message-----
Jean,

How do you have a column binding without a datasource? I would thinkthat you have to have an underlying column to bind to.

Regardless, what you could do is get the value using the Item property(the indexer) of the data grid. This will give you the value at aparticular row and column.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jean Carlo" <an*******@discussions.microsoft.com> wrote in messagenews:03****************************@phx.gbl...
Hello guys

I`m developing a windows form that contain one Datagrid.
In this datagrid I insert a checkBox Column. I need to get
all rows where checkbox is checked by user.
How do I get this rows ?
I canīt use the DataSource of Datagrid because I donīt
have a Column source for checkBox in my DataSource.
Is there any method in datagrid to loop in datagrid rows ?

Tks a lot.

Jean Carlo Mendes
.

Nov 15 '05 #3
Jean,

If you have a column in the datasource then you should check that. The
grid is going to be bound to the datasource and when you check the grid, the
data source will be updated.

The indexer can be accessed like this:

// Get the value of first column in the first row. The data grid is named
mobjGrid.
bool pblnBool = (bool) mobjGrid[0, 0];
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jean Carlo" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
Hi Nicholas
I have a column in my dataSource but I need to get only
rows checked by user in interface.
We donīt have an "Item" property in DataGrid... itīs my
problem...
What means "the indexer" of DataGrid ... I canīt see this
property.

Tks for your reply

[]s

Jean
-----Original Message-----
Jean,

How do you have a column binding without a datasource? I would thinkthat you have to have an underlying column to bind to.

Regardless, what you could do is get the value using the Item property(the indexer) of the data grid. This will give you the value at aparticular row and column.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jean Carlo" <an*******@discussions.microsoft.com> wrote in messagenews:03****************************@phx.gbl...
Hello guys

I`m developing a windows form that contain one Datagrid.
In this datagrid I insert a checkBox Column. I need to get
all rows where checkbox is checked by user.
How do I get this rows ?
I canīt use the DataSource of Datagrid because I donīt
have a Column source for checkBox in my DataSource.
Is there any method in datagrid to loop in datagrid rows ?

Tks a lot.

Jean Carlo Mendes
.

Nov 15 '05 #4
Thanks Nicholas

You are right !
I can get values. I did a loop in DataSource rows and get
values.
I made a mistake... i put the source column of my checkbox
in the last position of my sqlQuery and put the checkbox
as first column of my dataGrid... when I tried to get
checkbox value I get it in first position of item
collection.... and of course I get wrong values.

Thanks a lot !

[]s

Jean Carlo Mendes

I alredy tried to do it but I canīt see the values
-----Original Message-----
Jean,

If you have a column in the datasource then you should check that. Thegrid is going to be bound to the datasource and when you check the grid, thedata source will be updated.

The indexer can be accessed like this:

// Get the value of first column in the first row. The data grid is namedmobjGrid.
bool pblnBool = (bool) mobjGrid[0, 0];
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jean Carlo" <an*******@discussions.microsoft.com> wrote in messagenews:02****************************@phx.gbl...
Hi Nicholas
I have a column in my dataSource but I need to get only
rows checked by user in interface.
We donīt have an "Item" property in DataGrid... itīs my
problem...
What means "the indexer" of DataGrid ... I canīt see this
property.

Tks for your reply

[]s

Jean
-----Original Message-----
Jean,

How do you have a column binding without a

datasource? I would think
that you have to have an underlying column to bind to.

Regardless, what you could do is get the value using

the Item property
(the indexer) of the data grid. This will give you the

value at a
particular row and column.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jean Carlo" <an*******@discussions.microsoft.com> wrote

in message
news:03****************************@phx.gbl...
Hello guys

I`m developing a windows form that contain one Datagrid.
In this datagrid I insert a checkBox Column. I need to getall rows where checkbox is checked by user.
How do I get this rows ?
I canīt use the DataSource of Datagrid because I donīt
have a Column source for checkBox in my DataSource.
Is there any method in datagrid to loop in datagrid rows ?
Tks a lot.

Jean Carlo Mendes
.

.

Nov 15 '05 #5
Hi,

I am not sure you can have an unbound column - you should probably need to
create an underlying bogus column in the data source. But, assuming unbound
columns are possible, you can access DataGrid values by using its Item
property. The trick is that this property is visible as an indexer in C#.

Therefore your code checking if a row has been ticked will look like:

bool checked = theGrid[rowIndex, checkBoxColumnIndex];

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jean Carlo" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
Hello guys

I`m developing a windows form that contain one Datagrid.
In this datagrid I insert a checkBox Column. I need to get
all rows where checkbox is checked by user.
How do I get this rows ?
I can?t use the DataSource of Datagrid because I don?t
have a Column source for checkBox in my DataSource.
Is there any method in datagrid to loop in datagrid rows ?

Tks a lot.

Jean Carlo Mendes

Nov 15 '05 #6

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

Similar topics

9
by: Lina | last post by:
Hi, Can anyone tell me if it is possible to add link buttons to a datagrid that has its source set to a datatable that i have created? i.e i want the user to be able to select a room from...
2
by: Tamlin | last post by:
Hi all, I'm getting a bug with the datagrid object. I've created one from scratch, bound it to a dataview with 2 int32 columns and formatted the output as currency. I've found that when you...
0
by: Mauro | last post by:
Hi, I need a big help to resolve this problem. I need to put a usercontrol in a datagrid: this control check if the code inserted is present in a archive and if not return a error message. (In...
3
by: Hoodworld | last post by:
Hi All, I have a ASP.Net application written in C# with the use of Visual Studio 2003. When I develop and test the application in my company using ASP.Net Framework 1.4.33.2 in Windows XP...
2
by: Raj | last post by:
Hi, When we are sorting the DataGrid Boolean column the grid is becoming redcross. I have my own PPMIPDataGridBoolColumn class inherited from System.Windows.Forms.DataGridBoolColumn. In this...
3
by: Ryan Liu | last post by:
Hi there, I got a NullReferenceException when delete last row in a datagrid. I had hard time to solve since it does not occur in my own code. I put a datagrid in my inherited user control,...
0
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid with smartnavigation enabled. In this webpage I have a button that...
8
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a...
4
by: Steve | last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while back, also in VB.NET. I aplied some new things I learned. Anyway, here is my problem....... I have a custom DataGrid...
6
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.