473,508 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting row header text in datagrid: TopRow() not recognized

i am trying to set the text of the row header in a datagrid
i found several examples
in all cases the TopRow() property is not recognized by VS.NET
any help appreciated!

VERSION 1
(based on code found at
http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q896q
)
Private Sub dataGrid1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim row As Integer = TopRow()
Dim yDelta As Integer = DataGrid1.GetCellBounds(row, 0).Height
+ 1
Dim y As Integer = DataGrid1.GetCellBounds(row, 0).Top + 2
Dim cm As CurrencyManager =
CType(Me.BindingContext(DataGrid1.DataSource, DataGrid1.DataMember),
CurrencyManager)
While y < DataGrid1.Height - yDelta And row < cm.Count
'get & draw the header text...
Dim [text] As String = String.Format("row{0}", row)
e.Graphics.DrawString([text], DataGrid1.Font, New
SolidBrush(Color.Black), 12, y)
y += yDelta
row += 1
End While
End Sub 'dataGrid1_Paint
VERSION 2

Private Sub dataGrid1_Paint(ByVal sender As Object, ByVal e As
PaintEventArgs)
Dim row As Integer
row = TopRow()
Dim cm As CurrencyManager
cm = CType(Me.BindingContext(Me.DataGrid1.DataSource,
Me.DataGrid1.DataMember), CurrencyManager)
Do While ((row < cm.Count))
'get & draw the header text...
Dim text1 As String
If Len(Trim(Me.DataGrid1(row, 1))) = 2 Or
Len(Trim(Me.DataGrid1(row, 1))) = 5 Then
text1 = "+/-"
Else
text1 = ""
End If
e.Graphics.DrawString(text1, Me.DataGrid1.Font, New
SolidBrush(Color.Red), 12, (Me.DataGrid1.GetCellBounds(row,
0).Location.Y))
row = (row + 1)
Loop
End Sub
Nov 21 '05 #1
1 4100
Hi,

TopRow is a function that was added.
pointInCell00 = New Point((dataGrid1.GetCellBounds(0, 0).X + 4),
(dataGrid1.GetCellBounds(0, 0).Y + 4))

Public Function TopRow() As Integer

Dim hti As DataGrid.HitTestInfo

hti = dataGrid1.HitTest(Me.pointInCell00)

Return hti.Row

End Function

Ken

-------------------

"Mad Scientist Jr" <us*************@yahoo.com> wrote in message
news:7a**************************@posting.google.c om...
i am trying to set the text of the row header in a datagrid
i found several examples
in all cases the TopRow() property is not recognized by VS.NET
any help appreciated!

VERSION 1
(based on code found at
http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q896q
)
Private Sub dataGrid1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim row As Integer = TopRow()
Dim yDelta As Integer = DataGrid1.GetCellBounds(row, 0).Height
+ 1
Dim y As Integer = DataGrid1.GetCellBounds(row, 0).Top + 2
Dim cm As CurrencyManager =
CType(Me.BindingContext(DataGrid1.DataSource, DataGrid1.DataMember),
CurrencyManager)
While y < DataGrid1.Height - yDelta And row < cm.Count
'get & draw the header text...
Dim [text] As String = String.Format("row{0}", row)
e.Graphics.DrawString([text], DataGrid1.Font, New
SolidBrush(Color.Black), 12, y)
y += yDelta
row += 1
End While
End Sub 'dataGrid1_Paint
VERSION 2

Private Sub dataGrid1_Paint(ByVal sender As Object, ByVal e As
PaintEventArgs)
Dim row As Integer
row = TopRow()
Dim cm As CurrencyManager
cm = CType(Me.BindingContext(Me.DataGrid1.DataSource,
Me.DataGrid1.DataMember), CurrencyManager)
Do While ((row < cm.Count))
'get & draw the header text...
Dim text1 As String
If Len(Trim(Me.DataGrid1(row, 1))) = 2 Or
Len(Trim(Me.DataGrid1(row, 1))) = 5 Then
text1 = "+/-"
Else
text1 = ""
End If
e.Graphics.DrawString(text1, Me.DataGrid1.Font, New
SolidBrush(Color.Red), 12, (Me.DataGrid1.GetCellBounds(row,
0).Location.Y))
row = (row + 1)
Loop
End Sub
Nov 21 '05 #2

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

Similar topics

21
3931
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
1
8892
by: Webgour | last post by:
Hi, I'm tring to add a column to a datagrid with a linkbutton as header that can be used to sort the column. The column and the linkbutton are added programmatically (see below). However the...
4
6184
by: Adam Boczek | last post by:
I've a dropdownlist control to change language on my page. Because of page lifetime, I have to set all my labels, texts etc. from ResourceManager in prerender handler to be sure that culture change...
2
4224
by: saleek | last post by:
I was wondering if there is a way I can add an extra header to a datagrid? I found this solution on the internet - but it seems quite old and didn't work for me. ...
0
876
by: Tim::.. | last post by:
Hi, Can someone tell me how I sort a datagrid when using ActiveDirectory as my Datasource! I would like to be able to add sorting to my datagrid but don't know how to achive it! Thanks for...
1
1235
by: Mad Scientist Jr | last post by:
I am having a hard time figuring out how to set header text for a datagrid - I have found a number of pages on it but none work. Some seem to be for vb.net desktop applications not web. Can...
2
8581
by: Santosh | last post by:
Dear all i want to bind data to datagrid header template i am wrtting follwing code it is displaying data with in item template not but it is display data in header template <asp:DataGrid...
1
1312
by: Santosh | last post by:
Dear all I am writting following code for binding data to the header template of the datagrid on the button click event. but it gives me an error object referance is not set to an item of object...
1
6441
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
7331
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,...
1
7054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
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,...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1564
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 ...
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
424
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...

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.