-
Nov 1st, 2023, 03:59 PM
#1161
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Was looking through this thread, but couldn't find an answer to my question, which is, Is there an auto-column-width function built in that would automatically set the columns' width to the longest string in those columns. I have used the MSFlexgrids for quite a while, and your vbFlexGrid for quite a few months now. I could not find such an enhancement in either. I have always set the column width 'by hand' when setting up a grid...
just wondering
Sammi
Sam I am (as well as Confused at times).
-
Nov 1st, 2023, 11:49 PM
#1162
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by SamOscarBrown
Was looking through this thread, but couldn't find an answer to my question, which is, Is there an auto-column-width function built in that would automatically set the columns' width to the longest string in those columns. I have used the MSFlexgrids for quite a while, and your vbFlexGrid for quite a few months now. I could not find such an enhancement in either. I have always set the column width 'by hand' when setting up a grid...
just wondering
Sammi
.AutoSize method.
-
Nov 2nd, 2023, 03:17 PM
#1163
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Erwin69
When working with sets of data, there is for example the Recordset.GetRows feature to quickly move all data retrieved from a database into an array. For exporting to Excel there is the Range.Resize function to quickly move the data from an array into a worksheet.
I guess the VBFlexGrid control offers such features as well, but haven't figured it out yet. If it indeed does, can you give me some pointers on how to do that?
Update released.
Included the CopyFromRecordset function which copies the contents of an ADO or DAO Recordset onto the flex grid.
It works like the Excel function which returns the number of fetched records and copies from the current position to EOF.
The number of maximum rows and columns can be specified.
If omitted it is maximum remaining rows and columns that the grid can receive relative to the destination starting point.
The grid will not grow and it just ignores the overflow of rows and columns. (like Excel)
The destination row/col can be specified where the pasting onto the flex grid starts.
If omitted it is the first non-fixed row and first non-fixed column.
VBFlexGrid
Public Function CopyFromRecordset(Data As Object, [ByVal Rows As Long = -1], [ByVal Cols As Long = -1], [ByVal Row As Long = -1], [ByVal Col As Long = -1]) As Long
Excel
Function CopyFromRecordset(Data As Unknown, [MaxRows], [MaxColumns]) As Long
-
Nov 3rd, 2023, 11:53 AM
#1164
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Update released.
Edge case bugfix in the CopyFromRecordset function and minor tweaks. So, it's now hardened on DAO and ADO recordsets.
-
Nov 3rd, 2023, 05:19 PM
#1165
New Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hello, first of all thank you for the good work with the VBFlexgrid control. Lately I have changed from a grid control to vbflexgrid, I am trying to use the "Standard EXE Version" however when I am debugging VB6 it closes without giving any error. This is happening to me after switching from using the OCX version to the "EXE" version.
I also have a question about how to make the grid work, let's say I have 5 columns, in three of them the user must enter a sku and the name of the item appears in column 2 and in column 3 they must enter a price, and then jump to the next line in column 1, with BeforeEdit I can prevent the user from entering information in that column, but how can I make sure that the columns that are read-only do not accept the focus?
-
Nov 6th, 2023, 04:44 AM
#1166
Lively Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi!
Everything seems to be fine :-), thanks a lot.
My question is:
Could you add the possibility of having a button inside the cell ?, i can do it with a picture, etc..., but just to be like the combo and the checkbox, that you implemented it into the grid and is working so fine :-)
-
Nov 6th, 2023, 05:38 AM
#1167
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Calcu
Hi!
Everything seems to be fine :-), thanks a lot.
My question is:
Could you add the possibility of having a button inside the cell ?, i can do it with a picture, etc..., but just to be like the combo and the checkbox, that you implemented it into the grid and is working so fine :-)
There is already combo button (or combo cue button) available.
You can set a picture inside that button.
-
Nov 6th, 2023, 06:39 AM
#1168
Lively Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
but only a button, no a combo with button
-
Nov 6th, 2023, 08:14 AM
#1169
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Calcu
but only a button, no a combo with button
Just use a combo cue with button.
Evaluate BeforeEdit event. When Reason <> ComboCue then cancel. Otherwise cancel as well but execute your button click handler routine.
-
Nov 6th, 2023, 12:38 PM
#1170
Lively Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
But doing this way, i can't change the 3 dots inside the button with a text, for example
-
Nov 6th, 2023, 12:56 PM
#1171
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Calcu
But doing this way, i can't change the 3 dots inside the button with a text, for example
You can set a button picture. See ColComboButtonPicture or ComboButtonPicture.
Worst case set ComboButtonDrawMode to owner draw.
-
Nov 10th, 2023, 12:39 PM
#1172
New Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi!
I have a question.
Is there a way to define a column that cannot receive focus and also ignore those columns when the user moves with the keyboard from one column to another.
Something similar to how a "fixed column" works but not at the beginning, but between columns.
It turns out that I have tried to have certain columns disabled within the grid,
but so far I have not been able to.
Will there be a way to do it?
-
Nov 10th, 2023, 03:11 PM
#1173
Lively Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Do you need to not receive focus or it's enough to block the column to not edit it ?
To block it, in the cellbeforeEdit event you can use:
Code:
if col = 3 then
cancel = true
grid.col=4 ' you can send the focus to any col .
end if
For example.
-
Nov 10th, 2023, 05:46 PM
#1174
New Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Thanks!
what I need is to not receive focus.
example: On press enter or right arrow key move to next col enabled
Attachment 189242
-
Nov 11th, 2023, 04:09 AM
#1175
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by vb6nostalgia
Thanks!
what I need is to not receive focus.
example: On press enter or right arrow key move to next col enabled
Attachment 189242
Try the BeforeRowColChange event. That's for the caret.
There are also BeforeSelChange event.
-
Nov 11th, 2023, 11:51 PM
#1176
New Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Krool
Try the BeforeRowColChange event. That's for the caret.
There are also BeforeSelChange event.
thank you! I had only tried Before RowColChange, with your indication I understood better how to implement that operation.
that did the job.
Code:
Private Sub table1_BeforeRowColChange(ByVal NewRow As Long, ByVal NewCol As Long, Cancel As Boolean)
If NewCol = 2 Then
Cancel = True
table1.Col = 3
End If
End Sub
Private Sub table1_BeforeSelChange(ByVal NewRowSel As Long, ByVal NewColSel As Long, Cancel As Boolean)
If NewColSel = 2 Then
Cancel = True
End If
End Sub
-
Nov 16th, 2023, 02:01 AM
#1177
Addicted Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Krool
Update released.
Ok, I could now replicate this issue.... checking on the last column brought this up.
It's now fixed. Thanks.
Attachment 189035
Thanks a TON, krool. How great of you to remember even such a small request of mine and give a fix. Always in gratitude.
Have not been able to find focused time to get into this thread for the past few weeks. Hence, the delay in acknowledging.
Have a Divineful Day!
Kind Regards.
-
Nov 16th, 2023, 02:15 AM
#1178
Addicted Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
 Originally Posted by Krool
Update released.
Included the CopyFromRecordset function which copies the contents of an ADO or DAO Recordset onto the flex grid.
It works like the Excel function which returns the number of fetched records and copies from the current position to EOF.
The number of maximum rows and columns can be specified.
If omitted it is maximum remaining rows and columns that the grid can receive relative to the destination starting point.
The grid will not grow and it just ignores the overflow of rows and columns. (like Excel)
The destination row/col can be specified where the pasting onto the flex grid starts.
If omitted it is the first non-fixed row and first non-fixed column.
VBFlexGrid
Public Function CopyFromRecordset(Data As Object, [ByVal Rows As Long = -1], [ByVal Cols As Long = -1], [ByVal Row As Long = -1], [ByVal Col As Long = -1]) As Long
Excel
Function CopyFromRecordset(Data As Unknown, [MaxRows], [MaxColumns]) As Long
Great, krool. Some weeks back, when I needed this requirement, I stumbled upon our great Olaf's solution (cFlexSQLiteDS) here - https://www.vbforums.com/showthread....=1#post5514140 - it was very much for (y)our fabulous VBFlexGrid only. Olaf's readymade solution worked like a charm, as always. Its great now to see this functionality inbuilt in VBFlexGrid itself. I am yet to get time to download the latest VBFlexGrid and see what methodology you have adopted, to accomplish this 'CopyFromRecordSet' functionaltiy. The features you have specified for the CopyFromRecordSet function look wonderful. Thanks a TON. Looking forward to avail them soon, some time in the coming days.
Always remaining in gratitude to the wisdom of you, Olaf, LaVolpe, et al.
Kind Regards.
-
Nov 21st, 2023, 12:56 PM
#1179
Lively Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
Hi all, a new question (is not a problem with the grid itself), it's only to know the best way to do it.
I have a grid with .... 200 lines
I want to "auto select" 50 of them, via clipboard. I mean, i have a list with this 50 items to search at the grid, find and select them.
Actually i'm pasting the list on another grid and with a loop searching for the items on the first grid.
Is there any way to just drag a file (a txt with the items, one on each line) for example and select this? what event must i use fot this ?
Thanks !!!
For any who searchs something similar:
Event: BeforeClipboardAction
Code:
If Action = FlexClipboardActionPaste Then
Tcop = Clipboard.GetText
'do what you need
Cancel = True
end If
it's perfect.
thanks!
Last edited by Calcu; Nov 22nd, 2023 at 04:07 AM.
-
Nov 26th, 2023, 02:24 PM
#1180
Lively Member
Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)
@Krool do you think it's possible to make groups in vbflexgrid ?
Like this in excel :
(edit: trying to upload a gif in movement)
https://imgur.com/BGursmZ
Last edited by Calcu; Nov 26th, 2023 at 02:33 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|