The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Datagrid Multiple Selection
Posted: 13 Mar 07 10:56 AM
|
fiogf49gjkf0d Can anyone help with multiple selection in datagrid. Here is the situation:
If i select multiple rows in a datagrid and press the button, i need to display all the selected items in a memo field. Pls help
Thanks |
|
|
|
Re: Datagrid Multiple Selection
Posted: 13 Mar 07 1:17 PM
|
fiogf49gjkf0d I don't have access to SLX where I am at now, so guessing at the syntax, but here's the rundown for doing multi-select in a SLX grid:
1) In the grid properties make sure MultiSelect is set to True 2) Add your columns to the grid. You must also add the table's primary key value to the grid (you can then set it to hidden, but it must be explicitly added to the grid's layout). 3) Now you'll be able to access the primary key values for the selected rows at runtime via the grid's Selection collection. This will be a collection of the string values for the ID's for each selected row:
ie:
Dim id Dim idlist Dim i For i = 0 to DataGrid1.Selection.Count - 1 id = DataGrid1.Selection(i) ' do something with the ID value idlist = idlist & id & vbCrLf Next
MsgBox "Selected ID values are: " & vbCrLf & idlist
Make sense? |
|
|
| |
|
Re: Datagrid Multiple Selection
Posted: 14 Mar 07 7:56 AM
|
fiogf49gjkf0d Hi Ryan, Is possible to select multiple rows in datagrid? If not then how can I select multiple rows? I'm working on version 6.1.2 |
|
|
|
Re: Datagrid Multiple Selection
Posted: 14 Mar 07 9:17 AM
|
fiogf49gjkf0d If you're on 6.1 then you're out of luck with the SLX datagrid. The ability to do MultiSelect wasn't added until 6.2 IIRC.
You're only option is to use a 3rd party grid ActiveX control, or use the ListView instead. |
|
|
|
Re: Datagrid Multiple Selection
Posted: 18 Mar 07 11:39 PM
|
fiogf49gjkf0d Hi Ryan, Thanks for your help! Ryan, Can you give me any example of adding data in ListView. I'm trying to add but not succeeded. I want to add data in ListView from Recordset with check box option to select more than one record at a time. |
|
|
|
Re: Datagrid Multiple Selection
Posted: 19 Mar 07 6:07 PM
|
fiogf49gjkf0d Create a listview on a form, set the property to: and add some columns (we'll say you have three columns, for Account name, type, and web address):
Something like this (untested code):
Dim rs Dim li Set rs = Application.GetNewConnection("select * from account where account like 'A%'") With rs While Not .EOF Set li = ListView1.Items.Add li.Caption = .Fields("account").Value li.Tag = .Fields("accountid").Value ' to add other columns - ie: sub items li.SubItems.Add .Fields("type").Value & "" li.SubItems.Add .Fields("webaddress").Value & "" .MoveNext Next .Close End With Set rs = Nothing
Something like that. Beware, that code was from memory, so it may need some tweaks to run, but that should get you the general idea. |
|
|
|