Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




MSFlexGrid && Right Click


How do I select a cell in a MSFlexGrid using a right click




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MSFlexGrid Right Click
Morning/Afternoon all,

I have coded a 'copy row to clipboard' function on an MSFlexgrid when you right click on it. The only problem with this is that it copies the row that is highlighted, rather than the row that you right click on. The user has to left click a row and then right click for it to work.

Does anyone know how to copy the left click functionality (row select) to the right button as well?

MSflexgrid Click
Hi
I have an MSFlexgrid that contains 10 columns,upon clicking on a cell a messagebox appears,but if the user clicks on a cell whose column name is "Service" i don't want the messagebox to appear.
how can I do it?
thanks

Msflexgrid Click
I know that the code below with give me column and row info but how do I get information from header. The header is filled from a db with field named PersonName and PersonID.


VB Code:
MsgBox "Row: " & MSFlexGrid1.Row & " Col: " & MSFlexGrid1.Col

Click Outside Msflexgrid
I have this msflexgrid about 800 X 600 with variable row numbers, with events on cell clicks. What happends, when the rows are less then 10, there's some background showing which on click behaves like clicking on the last row, closest column. Is there a way to intercept that? Thanks

Click On MSFlexGrid…
I am using database by DAO with access and show data on texts and MSFlexGrid and i want when i click on any cell of MSFlexGrid, show that data i Clicked on the text .How can I do that?

i hope my question is clear.

thanks

MSflexgrid Click
On Form1 I have a MSflexgrid and text boxes that the user enters the info into. What I need is a click event for the flexgrid so when the record is clicked it will display that record in the text boxes.

Thanks

JO

MSFlexgrid Right-click
Does anyone know, how to make flexgrid react like Excels ?

If not several cells selected
Make a selection on the clicked Cell and display popupmenu
Else
display popupmenu

Thanks

/bno

MSFlexGrid Click Where There Is No Data
When my grid is half full I need to check whether the area of the grid that the user clicks on contains rows of data or not - any ideas? The grid may contain any number of rows depending on contents of database.

Msflexgrid Click Event
In the program I am working on I have an MSflexgrid and when the grid is clicked on I show another form with a second flexgrid if the row,col click on is not empty I break down the amount in second flexgrid. see below

'Code in VwEmpHst form grdSumm_Click event below

If grdSumm.TextMatrix(grdSumm.Row, grdSumm.Col) = "" Then
MsgBox " To see a break down of hours Click on Amount in hours column" _
& "After retrieving Employee data"
Exit Sub
End If

VwEmpAbstime.Show 1

A couple questions I have are. Can I pass varibles from the calling form to the VwEmpAbsTime form? If so How? I thought I would be able to do something like VwEmpAbstime(EmpID).show The syntax doesn't cause any error but when I try to pick them up in the load event it ie Private Sub Form_Load(EmpID05 As String) I get an error that says Procedure declaration does not match description of event or procedure having the same name.

Also I would like know how I can use use this command grdSumm.TextMatrix(grdSumm.Row, grdSumm.Col) = ... to see what which cell was clicked on.

As always I appreciate everyones help and patients with with me since I am new to VB and anxious to learn.

Thanks

Msflexgrid Click Events
how can i make only certain cells of msflexgrid clickable and certain ones not?
And can i make the click event of the msflexgrid do different things..ie, could i pass the column number to click event?

Code:
Private Sub MSFlexGrid1_Click(msflexgrid1.textmatrix(lastrow,3))'allrows and certain column
'do something
End Sub

Private Sub MSFlexGrid1_Click(msflexgrid1.textmatrix(lastrow,4))'allrows and certain column
'do something
End Sub

Mouse Click In MSFlexGrid
Hello All,

My program lists different data in rows of a FlexGrid. I can access further data by selection the row I want to look at and then use a Command Button click event.

How can I copy this event by using a , say, Double Click on my mouse?

Rgds

Tarablue

Double Click Msflexgrid
Is there a way to sense a double Right click in msflexgrid?

DblClick And Click On MSFlexGrid
I guess I am just missing it. I want a single click to be able to select a cell. I want a double click to call the "OK" command button. What am I doing wrong?


VB Code:
Private Sub Option_Select_Material_DblClick(Index As Integer)    Call cmd_Select_Material_OK_ClickEnd Sub Private Sub Select_Material_Grid_Click()    cmd_Select_Material_Apply.Enabled = TrueEnd Sub

Double Click On MSFlexgrid
hi..I have question regarding with MSFlexgrid. How to make (Coding) if user double clicks the selected grid in MSFlexgrid then it shows another form.

Thanks in advance

MSFlexgrid Click Event
Hi
I am using a Flexgrid in my VB6 form.When the form loads

VB Code:
Private Sub Form_Load()rs.Open "Select * from [Interval]", cn, adOpenKeyset, adLockPessimisticMSFlexGrid1.Row = rs.RecordCountrs.MoveFirstj = 1Do While Not rs.EOFMSFlexGrid1.TextMatrix(j, 0) = rs.Fields("Interval")MSFlexGrid1.RowData(j) = rs.Fields("IntID")rs.MoveNextj = j + 1Looprs.Close  rs1.Open "Select * from Room", cn, adOpenKeyset, adLockPessimisticMSFlexGrid1.Col = rs1.RecordCountrs1.MoveFirstj = 1Do While Not rs1.EOFMSFlexGrid1.TextMatrix(0, j) = rs1.Fields("Room")MSFlexGrid1.ColData(j) = rs1.Fields("RoomID")rs1.MoveNextj = j + 1Looprs1.Closeend sub


I obtain the following Flexgrid

Interval Room1 Room2
6h-7h
7h-8h
8h-9h
9h-10
if the user clicks on any row in colum1(6h-7h,7h-8h..) I don't want to generate any event, but if he clicks on any row of Column2 OR Column3 (Room1 or Room2) I want to type "Booked" in the clicked cell and then show form1.

Also when the user clicks on Clear,i want to clear MSFlexgrid except column1(Interval) and the first row(Interval Room1 Room2)

How can I do it?
thanks

MSFlexgrid Right Click (Resolved)
I have a MSFlexgrid and want to allow users to right click on a row and get a menu with some options on it.

So how do I :
1. Get a row to become highlighted when it is right clicked
2. Display a menu with some options

Fake A Click On MSFlexGrid
How can I "fake" a click on an MSFlexGrid via code so I can fire some other code?

Thanks!

Right-Click MSFlexGrid To Populate
I would like to be able to right-click on my MSFlexGrid and have the word "Bubba" appear in the cell I right-clicked in.

Any ideas on how to accomplish this?

Thanks,

MsFlexgrid ... Click On Title
When I click on the Title Row of a Gid

MSGrid.click gives me .ROW as to row where Cursor Last been

e.g .. I click on Title

debug

Row = 8

and I want to do soemthing else when I am in rows 1 to
.Rows

Can anybody tell me how to capture that I click on title row

Thanks in Advanc

Peter

MSFlexGrid Header Click
My app is using MSFlexGrid, the user adds data to fill the grid. There is an edit function, that allows the user to select a record from the grid to edit. This takes the selected record and puts the data back in the entry textboxes to allow editing. That works fine, the user can also doubleclick the record, that works fine. The problem is if the user clicks on one of the headers, the first record is always selected to edit, even if another record is highlighted. How can I either disable the headers from the click, or how can I select the correct record?

Thanks in advance.
Murray1840

Right Click Menus Fom Msflexgrid
Hi, proabbly a simple one but the vbhelp file only contains dhtml stuff for right click menus, not much use to me.

I have a msflexgrid I want to be able to right click on it and select to make a new entry or edit the current entry if one exists.

I've got everything else sorted aside from how to show a right click menu and set the itmes in the menu and thier associated actions, ie open add item form or open edit item form.

any help would be most appreciated.

Cheers

Mike

MSFlexGrid Click Event?
Hello,

I've been trying to figure out this problem for a while now and no luck so far.
Maybe you guys can help me please as i'm a VB newbie.

On my form I have two check boxes, one populates a combo box with two items the other with three items. The check boxes also switch frames on the same form with ZOrder, the frames have textboxes.

When an item is selected in the combo box my grid control(MSFlex) is filled with information from my Access mdb file.

Now here's the problem.
I want to be able to click on the rows in the grid list and input information from my mdb file in the textboxes.

Here's an example:

Select Book Number in combo books.
The MSFlex is filled with Book Numbers-Book#1,Book#2, Book#3 etc.

Now I want to click on the Book Numbers and fill the textboxes with corresponding information. Like Book 17 shows in text box txtTitle the title of Book 17.
txtAuthor is filled with the Author name of Book 17 etc....

MSFlexGrid Mouse Click
:confused:
I have an MSFlexGrid which allows the user to enter text in the cells, apart from the 1st row where I put the titles. I am using MSFlexGrid_EnterCell, MSFlexGrid_LeaveCell and txtCellEditor_KeyPress events.
Currently, the user can enter text and use the tab and return keys easily. My problem is that when clicking the mouse, nothing happens. How can I make it work? I tried to add MouseDown event and also MSFlexGrid_click event but neither has worked. On another version, I used GotFocus, LostFocus and KeyPress events and the mouse click worked ok but not the tab or return keys. It seems that they are mutually exclusive.
Can anyone help me please? All I want to allow in this grid navigation are the tab key, return key and the mouse click.
Most of my code shows below:

Private Sub Titles()
'Fill in the column titles.
Dim column As Integer
Dim columnname As Integer

MSFlexGrid1.Row = 0 'titles are only required at the top row
For column = 0 To (MSFlexGrid1.Cols - 1)

columnname = (column + 1)
With MSFlexGrid1
.Col = column
.TextStyle = flexTextFlat
.CellBackColor = RGB(10, 160, 280)
.CellFontSize = 9
'Place textbox over the current cell.
txtCellEditor.Visible = False
txtCellEditor.Top = .Top + .CellTop
txtCellEditor.Left = .Left + .CellLeft
txtCellEditor.Width = .CellWidth
txtCellEditor.Height = .CellHeight
'Assign cell contents to textbox
txtCellEditor.Text = "Location Code " & columnname

End With
'Move focus to textbox
txtCellEditor.Visible = True
'Disables edit of the title cells.
MSFlexGrid1.Enabled = False
Next column

' The following If-End if statement moves the focus to the next cell after the titles row.

If column = MSFlexGrid1.Cols Then
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 0
MSFlexGrid1.Visible = True
End If

End Sub

Sub MSFlexGrid1_EnterCell()
'Make sure the user doesn't attempt to edit the fixed cells
If (MSFlexGrid1.MouseRow = 0 Or MSFlexGrid1.Row = 0) Then
txtCellEditor.Visible = False
Exit Sub
End If
'Clear contents of current cell.
txtCellEditor.BackColor = RGB(255, 255, 255)
txtCellEditor.Text = ""
'Place textbox over the current cell.
txtCellEditor.Visible = False
With MSFlexGrid1
txtCellEditor.Top = .Top + .CellTop
txtCellEditor.Left = .Left + .CellLeft
txtCellEditor.Width = .CellWidth
txtCellEditor.Height = .CellHeight
'Assign cell contents to textbox
txtCellEditor.Text = .Text
End With
'Move focus to textbox
txtCellEditor.Visible = True
End Sub

Sub MSFlexGrid1_LeaveCell()
MSFlexGrid1.Text = txtCellEditor.Text
End Sub


Private Sub txtcelleditor_keypress(keyascii As Integer)
Dim SRow, SCol As Integer

Select Case keyascii
Case 13 'this is the Enter Key
With MSFlexGrid1
.Text = ""
SRow = .Row + 1
SCol = .ColSel
If SRow = .Rows Then
SRow = 1
If SCol < (.Cols - .FixedCols - 1) Then
SCol = SCol + 1
Else
SCol = 0
End If
End If
.Row = SRow
.Col = SCol
.RowSel = SRow
.ColSel = SCol
txtCellEditor.Text = .Text
txtCellEditor.Visible = True
txtCellEditor.SetFocus
keyascii = 0
End With
Case 9 'this is the Tab key
With MSFlexGrid1
.Text = ""
SCol = .Col + 1
SRow = .RowSel
If SCol = .Cols Then
SCol = 0
If SRow < (.Rows - .FixedRows - 1) Then
SRow = SRow + 1
Else
SRow = 1
End If
End If
.Row = SRow
.Col = SCol
.RowSel = SRow
.ColSel = SCol
txtCellEditor.Text = .Text
txtCellEditor.Visible = True
txtCellEditor.SetFocus
keyascii = 0
End With
End Select

MSFlexGrid Mouse Click
:confused:
I have an MSFlexGrid which allows the user to enter text in the cells, apart from the 1st row where I put the titles. I am using MSFlexGrid_EnterCell, MSFlexGrid_LeaveCell and txtCellEditor_KeyPress events.
Currently, the user can enter text and use the tab and return keys easily. My problem is that when clicking the mouse, nothing happens. How can I make it work? I tried to add MouseDown event and also MSFlexGrid_click event but neither has worked. On another version, I used GotFocus, LostFocus and KeyPress events and the mouse click worked ok but not the tab or return keys. It seems that they are mutually exclusive.
Can anyone help me please? All I want to allow in this grid navigation are the tab key, return key and the mouse click.
Most of my code shows below:

Private Sub Titles()
'Fill in the column titles.
Dim column As Integer
Dim columnname As Integer

MSFlexGrid1.Row = 0 'titles are only required at the top row
For column = 0 To (MSFlexGrid1.Cols - 1)

columnname = (column + 1)
With MSFlexGrid1
.Col = column
.TextStyle = flexTextFlat
.CellBackColor = RGB(10, 160, 280)
.CellFontSize = 9
'Place textbox over the current cell.
txtCellEditor.Visible = False
txtCellEditor.Top = .Top + .CellTop
txtCellEditor.Left = .Left + .CellLeft
txtCellEditor.Width = .CellWidth
txtCellEditor.Height = .CellHeight
'Assign cell contents to textbox
txtCellEditor.Text = "Location Code " & columnname

End With
'Move focus to textbox
txtCellEditor.Visible = True
'Disables edit of the title cells.
MSFlexGrid1.Enabled = False
Next column

' The following If-End if statement moves the focus to the next cell after the titles row.

If column = MSFlexGrid1.Cols Then
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 0
MSFlexGrid1.Visible = True
End If

End Sub

Sub MSFlexGrid1_EnterCell()
'Make sure the user doesn't attempt to edit the fixed cells
If (MSFlexGrid1.MouseRow = 0 Or MSFlexGrid1.Row = 0) Then
txtCellEditor.Visible = False
Exit Sub
End If
'Clear contents of current cell.
txtCellEditor.BackColor = RGB(255, 255, 255)
txtCellEditor.Text = ""
'Place textbox over the current cell.
txtCellEditor.Visible = False
With MSFlexGrid1
txtCellEditor.Top = .Top + .CellTop
txtCellEditor.Left = .Left + .CellLeft
txtCellEditor.Width = .CellWidth
txtCellEditor.Height = .CellHeight
'Assign cell contents to textbox
txtCellEditor.Text = .Text
End With
'Move focus to textbox
txtCellEditor.Visible = True
End Sub

Sub MSFlexGrid1_LeaveCell()
MSFlexGrid1.Text = txtCellEditor.Text
End Sub


Private Sub txtcelleditor_keypress(keyascii As Integer)
Dim SRow, SCol As Integer

Select Case keyascii
Case 13 'this is the Enter Key
With MSFlexGrid1
.Text = ""
SRow = .Row + 1
SCol = .ColSel
If SRow = .Rows Then
SRow = 1
If SCol < (.Cols - .FixedCols - 1) Then
SCol = SCol + 1
Else
SCol = 0
End If
End If
.Row = SRow
.Col = SCol
.RowSel = SRow
.ColSel = SCol
txtCellEditor.Text = .Text
txtCellEditor.Visible = True
txtCellEditor.SetFocus
keyascii = 0
End With
Case 9 'this is the Tab key
With MSFlexGrid1
.Text = ""
SCol = .Col + 1
SRow = .RowSel
If SCol = .Cols Then
SCol = 0
If SRow < (.Rows - .FixedRows - 1) Then
SRow = SRow + 1
Else
SRow = 1
End If
End If
.Row = SRow
.Col = SCol
.RowSel = SRow
.ColSel = SCol
txtCellEditor.Text = .Text
txtCellEditor.Visible = True
txtCellEditor.SetFocus
keyascii = 0
End With
End Select

MSHFlexGrid / MSFlexGrid Right Click Select Row
Is it possible to select a row in one of those two FlexGrids using the right button click?

Code:
Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbRightButton Then
MsgBox "Row: " & MSHFlexGrid1.Row
End If
End Sub
it always gives me the same row and I would like to make a seperate selection using right click for a popupmenu.

any help would be appreciated.

MSFlexGrid Question - Click Image
I get stocks quotes and display them in a msflexgrid. If a company makes an announcement I display a "bulb" next to the stock to indicate some news. (attached)

My question...is there a way so that if I click the bulb it opens a "news" form but if I click on the share code (or anywhere else within the cell except the bulb) I open another form?

MSFlexGrid Mouse Click Problem
Hi there,

I have an MSFlexGrid which allows the user to enter text in the cells, apart from the 1st row where I put the titles. I am using MSFlexGrid_EnterCell, MSFlexGrid_LeaveCell and txtCellEditor_KeyPress events.
Currently, the user can enter text and use the tab and return keys easily. My problem is that when clicking the mouse, nothing happens. How can I make it work? I tried to add MouseDown event and also MSFlexGrid_click event but neither worked.
On another version, I used GotFocus, LostFocus and KeyPress events and the mouse click worked ok but not the tab or return keys. It seems that they are mutually exclusive.
Can anyone help me please? All I want to allow in this grid navigation are the tab key, return key and the mouse click.
Most of my code shows below:

Code:
Private Sub Titles()
'Fill in the column titles.
Dim column As Integer
Dim columnname As Integer

MSFlexGrid1.Row = 0 'titles are only required at the top row
For column = 0 To (MSFlexGrid1.Cols - 1)

columnname = (column + 1)
With MSFlexGrid1
.Col = column
.TextStyle = flexTextFlat
.CellBackColor = RGB(10, 160, 280)
.CellFontSize = 9
'Place textbox over the current cell.
txtCellEditor.Visible = False
txtCellEditor.Top = .Top + .CellTop
txtCellEditor.Left = .Left + .CellLeft
txtCellEditor.Width = .CellWidth
txtCellEditor.Height = .CellHeight
'Assign cell contents to textbox
txtCellEditor.Text = "Location Code " & columnname

End With
'Move focus to textbox
txtCellEditor.Visible = True
'Disables edit of the title cells.
MSFlexGrid1.Enabled = False
Next column

' The following If-End if statement moves the focus to the next cell after the titles row.

If column = MSFlexGrid1.Cols Then
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 0
MSFlexGrid1.Visible = True
End If

End Sub

Sub MSFlexGrid1_EnterCell()
'Make sure the user doesn't attempt to edit the fixed cells
If (MSFlexGrid1.MouseRow = 0 Or MSFlexGrid1.Row = 0) Then
txtCellEditor.Visible = False
Exit Sub
End If
'Clear contents of current cell.
txtCellEditor.BackColor = RGB(255, 255, 255)
txtCellEditor.Text = ""
'Place textbox over the current cell.
txtCellEditor.Visible = False
With MSFlexGrid1
txtCellEditor.Top = .Top + .CellTop
txtCellEditor.Left = .Left + .CellLeft
txtCellEditor.Width = .CellWidth
txtCellEditor.Height = .CellHeight
'Assign cell contents to textbox
txtCellEditor.Text = .Text
End With
'Move focus to textbox
txtCellEditor.Visible = True
End Sub

Sub MSFlexGrid1_LeaveCell()
MSFlexGrid1.Text = txtCellEditor.Text
End Sub


Private Sub txtcelleditor_keypress(keyascii As Integer)
Dim SRow, SCol As Integer

Select Case keyascii
Case 13 'this is the Enter Key
With MSFlexGrid1
.Text = ""
SRow = .Row + 1
SCol = .ColSel
If SRow = .Rows Then
SRow = 1
If SCol < (.Cols - .FixedCols - 1) Then
SCol = SCol + 1
Else
SCol = 0
End If
End If
.Row = SRow
.Col = SCol
.RowSel = SRow
.ColSel = SCol
txtCellEditor.Text = .Text
txtCellEditor.Visible = True
txtCellEditor.SetFocus
keyascii = 0
End With
Case 9 'this is the Tab key
With MSFlexGrid1
.Text = ""
SCol = .Col + 1
SRow = .RowSel
If SCol = .Cols Then
SCol = 0
If SRow < (.Rows - .FixedRows - 1) Then
SRow = SRow + 1
Else
SRow = 1
End If
End If
.Row = SRow
.Col = SCol
.RowSel = SRow
.ColSel = SCol
txtCellEditor.Text = .Text
txtCellEditor.Visible = True
txtCellEditor.SetFocus
keyascii = 0
End With
End Select

MSFlexGrid: Let User Click/select Cel(s)
Good day,
I am doing some text editting:

MSFlexGrid with some texts has been initialized.
I add two buttons - "Bold Text" and "Italic Text" in the form interface.

I want to let the user select the text in one cell/multiple cells, then
click on "Bold Text" to influence the text in a particular cell/cells.

Private Sub MSFlexGrid1_GotFocus()

'Initialized some texts in certain cells.
With MSFlexGrid1

.TextMatrix(2, 3) = "Abraham"
.TextMatrix(3, 3) = "Jon"
.TextMatrix(3, 2) = "Tim"
.TextMatrix(4, 2) = "Peter"
.TextMatrix(5, 2) = "X - Men"

End With

End Sub

Private Sub cmdBold_Click()

'I want to bold the cell which is selected by user only,
'the following stmt will bold all the texts.
'How can I detect which cell/cells has been selected before bold the text(s) in cell/cells.

With MSFlexGrid1
.FontBold = True
End With

End Sub

Thanks in advance

Regards,
Peter

Detect Click On Picture In MSFlexGrid
Hi there...

I need to create a grid that display column with a picture and text.
The picture lets say it a small clock and 1mm from it to the right the text starts, lets say "Wake up"

I want to catch a click event ON THE PICTURE ONLY AND NOT ON THE TEXT OR ALL CELL.

One way I found is to devide the picture and the text into two columns, but I couldn't find way to hide the grid line between the two columns to let it seems as one.

If someone have any idea how to do that I will realy aapreciate it.
One thing! I have to use the MSFlexGrid and cannot use other grid control.

Thanks
yaron

MSFLEXGRID Click Event Problem
I Have a Form with some text boxes having data and a MSFlexGrid which displaying the same data. Now I need to to show the same data when I point on some row & If I click any row, a separate form has to be opened with the same data to edit. (No editing in the grid itself)

Regards
Rama Raju

MSFlexGrid Double Click Controll
Hi,
I have a MSFlexGrid that brings back data from an Access database, i want to be able to double click on one of the records brought back by the query, and have it populate text fields below.

My MsFlexGrid, only shows basic data like customer name, address etc.
but when you double click on them in the grid, it will put there info, + more info stored in the database, like account number, contacts etc.

Any ideas?

MSFlexGrid Question - Click Image
I get stocks quotes and display them in a msflexgrid. If a company makes an announcement I display a "bulb" next to the stock to indicate some news. (attached)

My question...is there a way so that if I click the bulb it opens a "news" form but if I click on the share code (or anywhere else within the cell except the bulb) I open another form?

MSFlexgrid Mouse Click Problem, HELP!
Hi,
I've been struggling for days on this now...

How can i get the correct col and row position after user right clicks a cell in a MSFlexgrid?

As far as I know, only left click updates those variables... Is there a work-a-round?

I want to use a popup menu on a right click, but I need the correct row and col position in order to fill the menu with the right values before displaying...

Thanks in advance!

Msflexgrid Select Row ,when Click Another Window
sir,
i have used msflexgrid control control connect database.
the records are stored in at that format,when select one rock then click
paricular row ,how to open another window

Right-click Multiple Cells In MSFlexGrid
Is it possible to select a range of cells using the right mouse button on an MSFlexGrid?

If so, how?

How To Trap Header Click In MsFlexGrid ?
Hi,

I am using MsFlexGridcontrol 6.0. How can I trap the Column Selected when user clicks on the Header of the Grid.

Regards

K. Prasad

Another Right-click PopUp Menu On MSFlexGrid Question
Hi there,

I've added code to the Mousedown event of the MSFlexgrid for a right-click PopUp Menu, and when I click on a cell and right-click the menu appears fine. But when I move to another cell, and right-click, the menu stays where it is rather than appearing on the cell I've right-clicked on - I have to left-click on the new cell first and then right-click. Does anyone know a way around it? (The mousedown event does not seem to fire for a right-click when the PopUp menu is showing....).

Here is my code:

Code:
Private Sub flgData_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)

If Button = vbRightButton Then
If flgData.MouseCol <> 0 And flgData.MouseRow <> 0 Then

flgData.Col = flgData.MouseCol
flgData.Row = flgData.MouseRow

PopupMenu

End If
End If

End Sub

MSFlexGrid Double Click And Add To List Controll
I have a MSFlex Grid that gets data from a search from an Access DB.

I wanted to be able to double click on the MSFlex Grid, and have it put the "ORDER_Num" into a ListBox.

Any ideas?

I later wanted to be able to export all the items in the listbox, to excel.

Also on another note, is how would i make a "back" button, so that if i were to mess up on a record, i can delete the last entry in the listbox?

here is my code so far


VB Code:
Private Sub MSFlexGrid1_DblClick()    If rs.State = adStateOpen Then rs.Close    With MSFlexGrid1        StrID = .TextMatrix(.MouseRow, 0) '1 is the column with the ID, if its not 1 change this    End With    sSQL = "SELECT * FROM [Lamp Exchanges Table] WHERE ID = " & StrID    rs.Open sSQL, cn, adOpenForwardOnly, adLockOptimistic    If Not rs.EOF Then    ' Updates all the fields when double clicking on the MSFlexGrid    ' This just puts the values of what ever is in the db, into the lower section.    ' We add " vbNullString because, if there is an blank value it will give an error  Label27.Caption = rs.Fields("ID").Value  Label28.Caption = rs.Fields("CASE_Num").Value  Label29.Caption = rs.Fields("FN").Value + " " + rs.Fields("LN").Value  Label30.Caption = rs.Fields("ADDR1").Value  Label31.Caption = rs.Fields("Addr 2").Value & vbNullString  Label32.Caption = rs.Fields("City").Value + "," + rs.Fields("State").Value + " " + rs.Fields("Zip").Value + vbNullString  Label33.Caption = rs.Fields("LAMP_Num").Value  Label34.Caption = rs.Fields("QTY").Value  Label35.Caption = rs.Fields("TRACK_Num").Value  'Label36.Caption = rs.Fields("Ship Date").Value  Label37.Caption = rs.Fields("ORDER_Num").Value  End If    If rs.Fields.Item("CLOSED").Value = True Then   Check1.Value = vbCheckedElse   Check1.Value = vbUncheckedEnd IfEnd Sub

How Can I Resolve Rt-Click In MSflexGrid Control Array
Hi,

I have a control array of MSFlexGrid1's and I would like to right click on one of them and take an action.

My test code below causes a compile error: "Proceedure Declaration does not match description of event or proceedure having the same name"

I have nothing with the same name.

Private Sub MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbRightButton Then
Debug.Print "right clicked"
End If
End Sub

I have nothing with the same name. Is the control array messing me up? How can I resolve the issue.

Thanks Robo

Detecing A Click On MSFlexGrid Fixed Rows
I want to sort the rows of a MSFlexGrid which has one fixed row where the field names are placed by clicking on a column header, i.e. I don't want any action to occur if any row other than the fixed row is clicked on. Now, I don't know how to determine that it's the fixed row that has been clicked on. If I use the row property it is returned as 1, just like the row immediately below containing the first data.

So the question is, obviously, how should I do it?... Thanks.

Here's the very straighforward code I use to sort a MSFlexGrid:

Private Sub MSFlexGrid1_Click()

Static Ascend As Boolean
Dim intSortOrder As Integer

If Ascend Then
intSortOrder = flexSortStringAscending
Else
intSortOrder = flexSortStringDescending
End If

MSFlexGrid1.Sort = intSortOrder
Ascend = Not Ascend

End Sub

Dbl Click Event (MSFlexGrid) Move Record To New Form.
hi,

I am developing a piece of software for a local college sports department. I am having difficulty with a function tough.

I have an MSflexgrid which is populated using a DAO data control.
it populates with the data from one of the tables in the database.

i am hoping to get it so that i can double click a record in the msflexgrid and on this event, it opens a new form and inputs the data into the necessary fields.

These fields are labels. (title, forename, surname, etc.)

any ideas?

my code is not worth displaying here.

Thanks,
Sam

MSFLEXGRID Auto Scrolls To Top When Click+Drag On A Fixed Hdr Cell
I have encountered a problem where my VB6 MSFLEXGRID auto scrolls to the top row in the grid when one does Mouse Click+Drag on a fixed hdr cell in the first row = 0, and the grid has been previously scrolled down manually so the top visible row is not the actual first row in the grid.

The Mouse Down event is executed before the auto scrolling starts, but I have not found a way to use this to intercept and prevent the auto scrolling to the top row in the grid while one has the mouse pressed down on a fixed header cell in row 0.

Does any one know a way to prevent this problem from ocurring.



How Can I Dynamically Scroll The Scroll Bar, Not By Mouse Click Manually For MSFLEXGRID?
How can I dynamically scroll the scroll bar, not by mouse click manually for MSFLEXGRID?

thank you!

Best Regards,

Kevin Shen

Making Right-Click In A ListBox Select An Item Exactly Like The Left Click.
Heres a start:


Code:
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'Place code to select the item
End Sub

I need help where the comment is. Thanks

Telling The Difference Between A OK Click And A Cancel Click On A Common Dialog Box..
When I load a mp3 file into my MMControl, it should then go and get the ID3 tags from it. But, I have a common dialog box so the user can specify what file they want to open. Now when they click the Cancel button it gives me an error because it's trying to get the ID3 tags from a file that blank filename.

To make a long story short: How do I tell when a user clicks the cancel button instead of the OK button on a File Open common dialog box.


Thanx,
Ben

Right-click Menu And Sending Left Click To Item
Can anyone tell me how I can use insert a right-click menu into my program so that when the user has selected a file (in a file list) and right-clicks, a menu appears at the location of the mouse pointer. I aleady know how to use the PopupMenu function to show a menu as I suppose that will need to be used, I just don't know how to capture a right-click mouse event and also use the position of the mouse pointer to show the menu.

Thanks in advance!

Transfer Of Data From Msflexgrid To Another Msflexgrid
Sir,
     how can i transfer the values of first row of Msflexgrid1 to first row of Msflexgrid2 placed in parallel of 1st one .


Moved from Code Bank - VB6 to VB General forum



Edited by - djjeavons on 2/19/2006 1:48:00 AM

Copy From Msflexgrid To Msflexgrid And Save Changes
I have created a data environment with a connection to a microsoft access database. Under my command for my table I created another command for another table with a relationship child/parent using the eventnumber field. This works great and shows the assignedvehicles compared to the eventnumber field on my form. What I am trying to do is add another msflexgrid that will show the availablevehicles and be able to drag one to the assignedvehicles and save. The problem I am having is saving the record when dragged. I have used code I got from a post from Chris Eastwood. Some of the fields are different and I only need to drag some of the fields not all.

Copyright © 2005-08 www.BigResource.com, All rights reserved