[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

Flexgrid Field Selection

Hello all!  My problem is this:

I want the user to be able to select several cells in a flexgrid and have those selections populate either a text box or a list box which ever you might recommend.

The reason for the selection is that those cells contain the primary keys to records in my database in which  several common calculations will be performed on.  So, the reason for the choice of text box vs. the list is b/c the entries in that control are going to be the parameter values in the next query.

So, let me again state my question..  How do I allow a user to select multiple values in a flexgrid and then populate another control w/ those values..

I know this is a relatively easy question for the caliber of programmers who frequent this site, however my head is spinning from the quest...Please Help..

Thank you..
John
0
johnmhat
Asked:
johnmhat
  • 3
  • 3
1 Solution
 
MarineCommented:
Its easy to select a range of rows in a flexgrid and then assign it to the textbox. But if you do this the values of the other row will replace the existing values in these textboxes wouldn't it ?
0
 
adityauCommented:
You can get to knowe about the selected values in the rows and columns using the following.

Private Sub Command1_Click()
    MSFlexGrid1.AllowBigSelection = True
    For inttemp = 1 To MSFlexGrid1.RowSel
        For inttemp1 = 1 To MSFlexGrid1.ColSel
            MsgBox MSFlexGrid1.TextMatrix(inttemp, inttemp1)
        Next
    Next
End Sub

You better use a list view or another grid to display the selected values as the values in the text box will be over written when you select another cell.
0
 
johnmhatAuthor Commented:
Yes, they could, but in this case that would be ok...

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
adityauCommented:
Then use Text box.
0
 
johnmhatAuthor Commented:
Adityau,  First, thanks for the help.
I tried the code, however it still selects only one record, I don't know what I am doing wrong or what I am not doing....
Here is the code I am using....

Private Sub cmdSelect_Click()
flexExpNumbers.AllowBigSelection = True
    For inttemp = 1 To flexExpNumbers.RowSel
        For inttemp1 = 1 To flexExpNumbers.ColSel
           Text25.Text = flexExpNumbers.TextMatrix(inttemp, inttemp1)
            Next
        Next

End Sub

Thanks,
0
 
adityauCommented:
Do you want all the values selected in the cells in the text box? If so, please set the Multiline property to True and then concatenate TextMatrix with vbCrlf.

Is it the one which is not working?
0
 
johnmhatAuthor Commented:
Thanks, sorry for the delay
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now