473,320 Members | 2,092 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,320 software developers and data experts.

DataGridViewRow.Height

Hi,

I want to make row higher when it is seleceted. See following code:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

List<Item> items = new List<Item>();
for (int i = 0; i < 100; i++)
{
items.Add(new Item());
}

itemDataGridView.SelectionMode =
DataGridViewSelectionMode.FullRowSelect;
itemBindingSource.DataSource = items;
this.itemDataGridView.SelectionChanged += new
EventHandler(itemDataGridView_SelectionChanged);
}

// this method calls one time during form loading, but all rows
have Height = 50
void itemDataGridView_SelectionChanged(object sender, EventArgs
e)
{
if (itemDataGridView.SelectedRows.Count == 1)
{
itemDataGridView.SelectedRows[0].Height = 50;
}
}
}

But after form is loaded ALL ROWS have height = 50. Handler
itemDataGridView_SelectionChanged called only one time during loading.
So what I'm doing wrong?

Feb 16 '06 #1
1 1933
Hi Yury,

Basically, in the class constructor, you are binding and attaching an
event handler, right?
'Handler
itemDataGridView_SelectionChanged called only one time during loading.
' > How is selection_Changed raised when loading? It is supposed to be
called only when the selected index changes. Are you modifying the
selected index in Form_Load or somewhere else?

Also, I think you should add code in itemDataGridView_SelectionChanged
to reset the height of the previously selected row. Otherwise, once you
have selected a row, it's height will remain 50.

Regards,

Jim

Feb 16 '06 #2

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

Similar topics

4
by: Paul | last post by:
Hi, I'm wondering if someone out there can help me overcome this quandary. I need to be able to calculate the height of the current page. I need to calculate the height of the page in pixels after...
10
by: John | last post by:
I have a table with two rows. On the first row is a text box and in the second row is an image. I have set the table cellpadding to 0 and cellspacing to 0. The table is leaving extra spaces in the...
1
by: polocar | last post by:
Ciao a tutti, leggendo qua e là per il forum ho scoperto che non sono l'unico ad avere questo problema. Se si inserisce un controllo ComboBox in un form di C#, non è possibile impostare la sua...
1
by: Robert Bravery | last post by:
HI All, I'm trying to loop through a datagridview, and use values found in various columns. But problem is that I get errors newar the end. I'm assuming that it is reading the blank row at the...
0
by: sklett | last post by:
<sigh....OK, here we go: I have a databound DGV using a binding source. There are some columns in the DGV which are NOT data bound. When I programatically add a new item to my collection that...
1
by: daokfella | last post by:
How come the cells collection is out of order from my designed gridview? I have a gridview with four columns. The first three are textbox columns and the fourth is a checkbox column. While viewing...
6
by: doomsday123 | last post by:
I want to add alternate text like on an html image to a DataGridViewRow. Is it possible?
1
by: mascouta | last post by:
I have a lot of problems with IE browser, one of them is described in this topic. in my website i have div Calculator with background image. it displayed perfectly with Firefox browser however in IE...
0
by: =?Utf-8?B?Q2xhdWRl?= | last post by:
I want to know if it's possible to set the DataBoundItem of a DataGridViewRow manually and if so, how ? The DataBoudItem is a read-only. You'll say : "use the Datasource property to set the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.