473,320 Members | 1,856 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.

Set a text in a RowHeader cell

Hi.

I need to set texts to the row headers of a Datagridview, like we can do with column headers.

For example:

========================================
| COLUMN A | COLUMN B | COLUMN B |
ROW 1 | | | |
ROW 2 | | | |
etc..
========================================
I need to set the Row 1, Row 2, etc, to each row header.

I tryed:
DataGridView1.Rows(i).HeaderCell.Value = "some text"
.... but did not works. No text is displayed

The reason I need to use row header is because I want to enjoy
the header behavior (it automatically changes appearance
on mouse mouse, marks the selected row, etc).

There is some manner to set the text?
Cesar

Feb 25 '06 #1
10 32248

"MSNews" <info(a)carsoftnet.com.br> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.

I need to set texts to the row headers of a Datagridview, like we can do
with column headers.

For example:

========================================
| COLUMN A | COLUMN B | COLUMN B |
ROW 1 | | | |
ROW 2 | | | |
etc..
========================================
I need to set the Row 1, Row 2, etc, to each row header.

I tryed:
DataGridView1.Rows(i).HeaderCell.Value = "some text"
.... but did not works. No text is displayed

The reason I need to use row header is because I want to enjoy
the header behavior (it automatically changes appearance
on mouse mouse, marks the selected row, etc).

There is some manner to set the text?

Cesar

' Create a new datagridView control.

datagridView1.Bounds = New Rectangle(New Point(20, 40), New Size(400, 160))

datagridView1.Columns.Add("FED", "FOD")

datagridView1.Rows.Add()

datagridView1.Rows(0).Cells(0).Value = "FOO"

datagridView1.Rows(0).HeaderCell.Value = "SOP"

Me.Controls.Add(datagridView1)


Feb 26 '06 #2
Hmm I got the point.

We must to use a data-unbound grid to can change the header cell.

Thanks.

Cesar
"Homer J Simpson" <no****@nowhere.com> wrote in message
news:bcpMf.5394$Cp4.4488@edtnps90...

"MSNews" <info(a)carsoftnet.com.br> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.

I need to set texts to the row headers of a Datagridview, like we can do
with column headers.

For example:

========================================
| COLUMN A | COLUMN B | COLUMN B |
ROW 1 | | | |
ROW 2 | | | |
etc..
========================================
I need to set the Row 1, Row 2, etc, to each row header.

I tryed:
DataGridView1.Rows(i).HeaderCell.Value = "some text"
... but did not works. No text is displayed

The reason I need to use row header is because I want to enjoy
the header behavior (it automatically changes appearance
on mouse mouse, marks the selected row, etc).

There is some manner to set the text?

Cesar

' Create a new datagridView control.

datagridView1.Bounds = New Rectangle(New Point(20, 40), New Size(400,
160))

datagridView1.Columns.Add("FED", "FOD")

datagridView1.Rows.Add()

datagridView1.Rows(0).Cells(0).Value = "FOO"

datagridView1.Rows(0).HeaderCell.Value = "SOP"

Me.Controls.Add(datagridView1)

Feb 27 '06 #3
Hmm I got the point.

We must to use a data-unbound grid to can change the header cell.

Thanks.

Cesar


"Homer J Simpson" <nobody@nowhere.com> wrote in message
news:bcpMf.5394$Cp4.4488@edtnps90...[color=blue]
>
> "MSNews" <info(a)carsoftnet.com.br> wrote in message
> news:uNVnyWkOGHA.3856@TK2MSFTNGP12.phx.gbl...
> Hi.
>
> I need to set texts to the row headers of a Datagridview, like we can do
> with column headers.
>
> For example:
>
> ========================================
> | COLUMN A | COLUMN B | COLUMN B |
> ROW 1 | | | |
> ROW 2 | | | |
> etc..
> ========================================
> I need to set the Row 1, Row 2, etc, to each row header.
>
> I tryed:
> DataGridView1.Rows(i).HeaderCell.Value = "some text"
> ... but did not works. No text is displayed
>
> The reason I need to use row header is because I want to enjoy
> the header behavior (it automatically changes appearance
> on mouse mouse, marks the selected row, etc).
>
> There is some manner to set the text?
>
> Cesar
>
> ' Create a new datagridView control.
>
> datagridView1.Bounds = New Rectangle(New Point(20, 40), New Size(400,
> 160))
>
> datagridView1.Columns.Add("FED", "FOD")
>
> datagridView1.Rows.Add()
>
> datagridView1.Rows(0).Cells(0).Value = "FOO"
>
> datagridView1.Rows(0).HeaderCell.Value = "SOP"
>
> Me.Controls.Add(datagridView1)
>
>
>
>[/color]

Hi

What is datagridview..
I want to display a text in rowheaders of DataGrid in C# not in GridView.. Please Give some ideas how to do that?
Mar 2 '06 #4
Can you also tell how to set the width of this column? so whatever text you
put there will be visible?
"Homer J Simpson" wrote:

"MSNews" <info(a)carsoftnet.com.br> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.

I need to set texts to the row headers of a Datagridview, like we can do
with column headers.

For example:

========================================
| COLUMN A | COLUMN B | COLUMN B |
ROW 1 | | | |
ROW 2 | | | |
etc..
========================================
I need to set the Row 1, Row 2, etc, to each row header.

I tryed:
DataGridView1.Rows(i).HeaderCell.Value = "some text"
.... but did not works. No text is displayed

The reason I need to use row header is because I want to enjoy
the header behavior (it automatically changes appearance
on mouse mouse, marks the selected row, etc).

There is some manner to set the text?

Cesar

' Create a new datagridView control.

datagridView1.Bounds = New Rectangle(New Point(20, 40), New Size(400, 160))

datagridView1.Columns.Add("FED", "FOD")

datagridView1.Rows.Add()

datagridView1.Rows(0).Cells(0).Value = "FOO"

datagridView1.Rows(0).HeaderCell.Value = "SOP"

Me.Controls.Add(datagridView1)


Apr 7 '06 #5

"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.com...
Can you also tell how to set the width of this column? so whatever text
you
put there will be visible?


Set the width to -1 or -2 and it will fit the data or the title.

Apr 9 '06 #6
Width of what?
The closest thing was
this.dataGridView1.Rows[0].HeaderCell.OwningColumn.Width but
this.dataGridView1.Rows[0].HeaderCell.OwningColumn is null
I can't figure out the column of the headercells
Column[-1] is an error!
"Homer J Simpson" wrote:

"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.com...
Can you also tell how to set the width of this column? so whatever text
you
put there will be visible?


Set the width to -1 or -2 and it will fit the data or the title.

Apr 10 '06 #7

"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com...
Width of what?
The closest thing was
this.dataGridView1.Rows[0].HeaderCell.OwningColumn.Width but
this.dataGridView1.Rows[0].HeaderCell.OwningColumn is null
I can't figure out the column of the headercells
Column[-1] is an error!


See "DataGridView control [Windows Forms], column sizing"

IIRC, it's DataGridView1.Columns(1).Width = -1 (but I coud be wrong)

Also see "How to: Set the Sizing Modes of the Windows Forms DataGridView
Control "

Apr 10 '06 #8
DataGridView1.Columns(1) is the second "Real" column in the grid!

I want to reference the grey column before it (-1) where you told the guy to
use
HeaderCell.Value
I looked in the Set the Sizing Modes of the Windows Forms DataGridView but
it does not reference this column.

"Homer J Simpson" wrote:

"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com...
Width of what?
The closest thing was
this.dataGridView1.Rows[0].HeaderCell.OwningColumn.Width but
this.dataGridView1.Rows[0].HeaderCell.OwningColumn is null
I can't figure out the column of the headercells
Column[-1] is an error!


See "DataGridView control [Windows Forms], column sizing"

IIRC, it's DataGridView1.Columns(1).Width = -1 (but I coud be wrong)

Also see "How to: Set the Sizing Modes of the Windows Forms DataGridView
Control "

Apr 10 '06 #9

"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
I want to reference the grey column before it (-1) where you told the guy
to
use
HeaderCell.Value
I looked in the Set the Sizing Modes of the Windows Forms DataGridView but
it does not reference this column.


Did you try

DataGridView1.RowHeadersWidthSizeMode = AutoSizeToAllHeaders

Apr 10 '06 #10
Yes! that did it!
Thank you!

"Homer J Simpson" wrote:

"Ofer" <Of**@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com...
I want to reference the grey column before it (-1) where you told the guy
to
use
HeaderCell.Value
I looked in the Set the Sizing Modes of the Windows Forms DataGridView but
it does not reference this column.


Did you try

DataGridView1.RowHeadersWidthSizeMode = AutoSizeToAllHeaders

Apr 10 '06 #11

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

Similar topics

7
by: Andrew Poulos | last post by:
I'm using the following code to create a small table with one column and two rows. An image goes into the first cell. //create table var t = document.createElement("TABLE"); t.style.position =...
1
by: glenn | last post by:
Hi folks, I need to have two ddl's in one DataGrid cell. The first ddl has a list of company names and the second has a list of contact names that work in the company name that was selected in...
2
by: Brian Parker | last post by:
I need to format text in cell in an Excel worksheet and I need to do this using C#. I've seen code that will set the format for the whole cell, but I just need to format one character in that...
1
by: meworkingman | last post by:
I'm a relative CSS newbie and I'm trying to do the following: I have a table that holds text that might span multiple cells. I want it to look something like this: ...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
In a datagridview, the first column header cell is columnHeader(0), which is immediately to the right of the Top Left Corner Select All cell. And the first RowHeader cell is RowHeaderCell(0) which...
14
by: Mike | last post by:
I have a gridview that has a button in the last cell of each row. I want to get the text from cell 1 for that row the button was clicked on. So if my gridview looks like this: N-12 BMW ...
0
by: S_K | last post by:
Hi, I have an editible GridView that I can read the contents of each cell of the edit row as follows: int iEditIndex = GridView2.EditIndex; string strName = GridView2.Rows.Cells.Text; This...
2
by: The Colorado Kid | last post by:
Ok, I've never seen this before, but for some reason I had a piece of continuous text as such (including quotes): 'text''text''text''text''text''text' and this, for some reason, was being displayed...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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
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...

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.