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

Datagridview loading rows

I think this a simple question but i'm breaking my brain without results.

I've a datagridview bounded to a datatable, with an imagecolumn that should
contain a different bitmap depending from a field in the bounded datatable.

my problem is to find an event raised for each rows loaded in the
datagridview, so
i can check my field and load the correct bitmap.

i tried RowsAdded event but it is raised only 2 times, even i'm loading 15
rows;
i tried also CellValueNeeded with the datagridview in virtual mode, but
e.RowIndex
was always 0

Example

Datatable rows
XXXXXX A -> need to load d.ico
YYYYYYY B -> need to load e.ico
ZZZZZZZ C -> need to load f.ico
my actual code (where dgvCards is mi datagridview)

if
(((DataTable)dgvCards.DataSource).Rows[e.RowIndex]["schtip"].ToString().Trim() == "S")
dgvCards.Rows[e.RowIndex].Cells["imagecolumn"].Value =
Properties.Resources.eico;
else
dgvCards.Rows[e.RowIndex].Cells["imagecolumn"].Value =
Properties.Resources.dico;
where do i need to put my code ?
thanks a lot
Mar 23 '06 #1
1 3017
In article <90**********************************@microsoft.co m>, Luca
Beretta wrote:
my problem is to find an event raised for each rows loaded in the
datagridview, so
i can check my field and load the correct bitmap.


I'm using the CellFormatting event to assign a background color based
on the value in a cell.

Mike

Mar 25 '06 #2

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

Similar topics

0
by: RSH | last post by:
I have a simple Windows Form, where i have a datagridview. The user can switch between databases and select the tables via DropDownLists. I am having a problem that I can't really pinpoint when...
1
by: RSH | last post by:
Hi, I have a situation where I have a DDL that lists all of the tables in a particular database, and a Datagridview which appears in the same from below the DDL.. When the user selects a new...
3
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate...
3
by: steve | last post by:
Hi All How can I get the datagridview to redraw after changing the rowtemplate.height at runtime ( it is databound to a datatable) I have tried datagridview1.refresh etc to no avail (The row...
3
by: mtczx232 | last post by:
I have form that have Datagridview. I want that grid stand on the last record when form open. then user can move down one line to add new record. I not find Property like current_index thet can be...
4
by: shibeta | last post by:
Hello, I have problem with DataGridView and BindingSource. I have created DataSet and added TableData to it with manualy created columns (without DataAdapter - I'm not using MSSQL). On the Form I...
3
by: =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post by:
New to databinding in vs2005, I always did it manually in 2003. I have no problem loading comboboxes, and a change in that combobox changes the data in the textboxes but I can not figure out a way...
1
by: Avedo | last post by:
Hello! I have a form application with a DataGridView, and an Save/Delete and Cancel button. When the application is opened, it is supplied an XML file that may or may not exist, and display the...
6
by: Ciaran | last post by:
I'm having a really strange issue with the DataGridView control in a VS2008 / .NET 3.5 winforms project. I have a simple form with a grid. In the form constructor I call a function to bind the grind...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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.