Page 30 of 30 FirstFirst ... 2027282930
Results 1,161 to 1,180 of 1180

Thread: VBFlexGrid Control (Replacement of the MSFlexGrid control)

  1. #1161
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    8,905

    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).

  2. #1162

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,272

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by SamOscarBrown View Post
    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.

  3. #1163

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,272

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Erwin69 View Post
    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

  4. #1164

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,272

    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.

  5. #1165
    New Member
    Join Date
    Oct 2023
    Posts
    4

    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?

  6. #1166
    Lively Member
    Join Date
    May 2022
    Posts
    69

    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 :-)

  7. #1167

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,272

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    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.

  8. #1168
    Lively Member
    Join Date
    May 2022
    Posts
    69

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    but only a button, no a combo with button

  9. #1169

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,272

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    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.

  10. #1170
    Lively Member
    Join Date
    May 2022
    Posts
    69

    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

  11. #1171

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,272

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Calcu View Post
    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.

  12. #1172
    New Member
    Join Date
    Oct 2023
    Posts
    4

    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?

  13. #1173
    Lively Member
    Join Date
    May 2022
    Posts
    69

    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.

  14. #1174
    New Member
    Join Date
    Oct 2023
    Posts
    4

    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

  15. #1175

    Thread Starter
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,272

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by vb6nostalgia View Post
    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.

  16. #1176
    New Member
    Join Date
    Oct 2023
    Posts
    4

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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

  17. #1177
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    188

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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.

  18. #1178
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    188

    Re: VBFlexGrid Control (Replacement of the MSFlexGrid control)

    Quote Originally Posted by Krool View Post
    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.

  19. #1179
    Lively Member
    Join Date
    May 2022
    Posts
    69

    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.

  20. #1180
    Lively Member
    Join Date
    May 2022
    Posts
    69

    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.

Page 30 of 30 FirstFirst ... 2027282930

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width