473,840 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2641
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.co m

"Jean Carlo" <an*******@disc ussions.microso ft.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.co m

"Jean Carlo" <an*******@disc ussions.microso ft.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.co m

"Jean Carlo" <an*******@disc ussions.microso ft.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.co m

"Jean Carlo" <an*******@disc ussions.microso ft.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.co m

"Jean Carlo" <an*******@disc ussions.microso ft.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.co m

"Jean Carlo" <an*******@disc ussions.microso ft.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, checkBoxColumnI ndex];

--
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*******@disc ussions.microso ft.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
1746
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 various comboboxes and textboxes on my form. when they are satisfied they press OK. the row is then displayed in my datagrid. I now automaticcaly want 2 link buttons to appear next to the row that allows the user to delete the row or edit it.
2
3280
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 use the F2 key to enter edit mode and then hit TAB or ESCAPE without actually editing the value, dotnet crashes with a null reference error.
0
3554
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 the example I have changed this check with a easy "if string is empty" ) Everything would be easy if the datagrid had a predictable behaviour. I explain my problem.
3
1364
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 Enterprise Standard Edition and Windows XP Professional, the datagrid control can return all records. When I deploy all the files to the client and run it, the datagrid returns the 1st row of the whole recordset. I tried different methods to solve...
2
2359
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 inherited class I have one DataGridValueChangedEventHandler event handler. I am overriding Edit() to know the current state of the cell. I am overriding Paint() to know the if the user has been editing the cell. I am also overriding the Commit() to
3
5049
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, then put this control on a form. I use DataAdaptor to fill the data table and update database.
0
1072
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 fills the datagrid with data and creates new rows in the database. In windows XP clients this webpage works fine but only in windows 2000 clients doesn't work. The updates of the database are done but the datagrid doesn't refresh
8
1967
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 button that inserts a new row in the SQL table and then refresh the datagrid.
4
1833
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 with a buttonRow that does a delete function for me. Microsoft support helped me back then to get this done. Here is part of the code that creates the dataGrid: Dim ButtonColStyle As DataGridButtonColumn
6
2752
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 freeze.
0
9856
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9698
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10598
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9436
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5684
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.