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

MSFlex Grid Control - Fixed Rows

Hello,

I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
column. I am trying to do a sort when the user clicks a column in the FIXED
ROW. But when I capture the row number in the click event I get row = 1 if I
click on the FIXED row OR the actual row 1. How can I get the grid control
to tell me when the user has clicked on the FIXED row and not on row 1
(since they both produce row = 1 and I cannot tell them apart when it does
this)?

Thank you.
Otis
Mar 8 '06 #1
4 11155
????

You say you want to sort when the user clicks a column in the fixed row
(which is the row across the top of the control), then go on to say you are
capturing the row number in the click event which will always be (correctly)
1 because clicking the header selects the entire column and moves the focus
rectangle to the first work row (the row 1 you mention).

If you want to determine the column clicked when a header in the top fixed
row is clicked, all you need is:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Row = 1 Then
Debug.Print MSFlexGrid1.Col
End If
End Sub
Similarly the reverse holds true for detecting the row clicks when the row
fixed header is clicked:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Col= 1 Then
Debug.Print MSFlexGrid1.Row
End If
End Sub

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.


"Otie" <ot*********@adelphia.net> wrote in message
news:SI********************@adelphia.com...
Hello,

I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
column. I am trying to do a sort when the user clicks a column in the FIXED
ROW. But when I capture the row number in the click event I get row = 1 if I
click on the FIXED row OR the actual row 1. How can I get the grid control
to tell me when the user has clicked on the FIXED row and not on row 1
(since they both produce row = 1 and I cannot tell them apart when it does
this)?

Thank you.
Otis
Mar 9 '06 #2
You can also use the MouseRow and MouseCol properties.

Rick

"Randy Birch" <rg************@mvps.org> wrote in message
news:44**********************@news.astraweb.com...
????

You say you want to sort when the user clicks a column in the fixed row
(which is the row across the top of the control), then go on to say you are capturing the row number in the click event which will always be (correctly) 1 because clicking the header selects the entire column and moves the focus rectangle to the first work row (the row 1 you mention).

If you want to determine the column clicked when a header in the top fixed
row is clicked, all you need is:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Row = 1 Then
Debug.Print MSFlexGrid1.Col
End If
End Sub
Similarly the reverse holds true for detecting the row clicks when the row
fixed header is clicked:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Col= 1 Then
Debug.Print MSFlexGrid1.Row
End If
End Sub

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.


"Otie" <ot*********@adelphia.net> wrote in message
news:SI********************@adelphia.com...
Hello,

I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
column. I am trying to do a sort when the user clicks a column in the FIXED ROW. But when I capture the row number in the click event I get row = 1 if I click on the FIXED row OR the actual row 1. How can I get the grid control
to tell me when the user has clicked on the FIXED row and not on row 1
(since they both produce row = 1 and I cannot tell them apart when it does
this)?

Thank you.
Otis

Mar 9 '06 #3
I think you misunderstand.

When I click on column 9 in the fixed row, VB returns row = 1. I want this
click to do a sort on the data in column 9.
But when I click on the CELL in column 9, row 1, or any row, I want to take
that cell value and store it somewhere.
The problem with VB is that if you click on any column in a fixed row it
returns the row number as if you had clicked on the actual row 1, not in the
fixed row. These different clicks (one on the fixed row, column 9 and the
other on the actual row 1 [non-fixed row], column 9) HAVE TO be detected
differently or else I am screwed (I won't be able to detect when the user
wants to sort versus when he wants to capture cell contents.

I hope I am more clear here.

I will try Rick's suggestion about MouseRow.

Thank you.

--

Otis

"Randy Birch" <rg************@mvps.org> wrote in message
news:44**********************@news.astraweb.com...
????

You say you want to sort when the user clicks a column in the fixed row
(which is the row across the top of the control), then go on to say you
are
capturing the row number in the click event which will always be
(correctly)
1 because clicking the header selects the entire column and moves the
focus
rectangle to the first work row (the row 1 you mention).

If you want to determine the column clicked when a header in the top fixed
row is clicked, all you need is:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Row = 1 Then
Debug.Print MSFlexGrid1.Col
End If
End Sub
Similarly the reverse holds true for detecting the row clicks when the row
fixed header is clicked:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Col= 1 Then
Debug.Print MSFlexGrid1.Row
End If
End Sub

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.


"Otie" <ot*********@adelphia.net> wrote in message
news:SI********************@adelphia.com...
Hello,

I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
column. I am trying to do a sort when the user clicks a column in the
FIXED
ROW. But when I capture the row number in the click event I get row = 1 if
I
click on the FIXED row OR the actual row 1. How can I get the grid control
to tell me when the user has clicked on the FIXED row and not on row 1
(since they both produce row = 1 and I cannot tell them apart when it does
this)?

Thank you.
Otis

Mar 9 '06 #4
From VB Help (don't know why I didn't see this - have used the grid control
for years - yikes!):
MouseCol, MouseRow Properties

Remarks

Use these properties programmatically to determine the mouse location. These
properties are useful in displaying context-sensitive help for individual
cells and testing whether the user has clicked on a fixed row or column.

This looks like the way to do it.

Thank you so much.


--
Otis

"Rick Rothstein [MVP - Visual Basic]" <ri************@NOSPAMcomcast.net>
wrote in message news:Vp********************@comcast.com...
You can also use the MouseRow and MouseCol properties.

Rick

"Randy Birch" <rg************@mvps.org> wrote in message
news:44**********************@news.astraweb.com...
????

You say you want to sort when the user clicks a column in the fixed row
(which is the row across the top of the control), then go on to say you

are
capturing the row number in the click event which will always be

(correctly)
1 because clicking the header selects the entire column and moves the

focus
rectangle to the first work row (the row 1 you mention).

If you want to determine the column clicked when a header in the top
fixed
row is clicked, all you need is:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Row = 1 Then
Debug.Print MSFlexGrid1.Col
End If
End Sub
Similarly the reverse holds true for detecting the row clicks when the
row
fixed header is clicked:

Private Sub MSFlexGrid1_MouseDown(...
If MSFlexGrid1.Col= 1 Then
Debug.Print MSFlexGrid1.Row
End If
End Sub

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/

Please reply to the newsgroups so all can participate.


"Otie" <ot*********@adelphia.net> wrote in message
news:SI********************@adelphia.com...
Hello,

I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed
column. I am trying to do a sort when the user clicks a column in the

FIXED
ROW. But when I capture the row number in the click event I get row = 1
if

I
click on the FIXED row OR the actual row 1. How can I get the grid
control
to tell me when the user has clicked on the FIXED row and not on row 1
(since they both produce row = 1 and I cannot tell them apart when it
does
this)?

Thank you.
Otis


Mar 9 '06 #5

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

Similar topics

5
by: Chad | last post by:
for ease of use, and for features such as resizable columns, edit in place, horiz and vertical scrolling, heirarchy display, etc?
2
by: Tom | last post by:
I need to display a series of controls (in my case, a custom control) in a grid-like fashion. This means this particular control would be repeated multiple times, arranged in a row/column format....
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
0
by: romancoelho | last post by:
Hey everyone, I know this has to be simple, but can't figure out how to do it. How can I display the grid lines in all rows in the gird. The default behavior of the DataGridView seems to be that it...
1
by: sonali_aurangabadkar | last post by:
i want to edit whole grid on singel button click
0
by: Pramuditha | last post by:
can i sort a msflex control column while there is a column header? how?
1
by: firozfasilan | last post by:
How Can we Print(Hard copy) the Contents of a MSFlex Grid control Please Explain with the help of code i am waiting
0
Ali Rizwan
by: Ali Rizwan | last post by:
Hello Everybody I want to take the print of only MSFlex grid instead of whole page. How can i do this? And How can i adjust the quality of print and size? My flexgrid has 40-50 rows and 6 columns...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
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: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...

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.