I was really excited but now disappointed - FlexGrid tool
I was really really excited to do this project, However it goes BEYOND my knowledge of VB.. It was "suppossed" to be a fairly easy project I first thought.. Then, I realized there is no way I could do this on my own.. So, I have given up and "if" there is someone that has the knowledge to continue it or make one I would love it. Very sad that I could not accomplish this tho I was trying really hard.. It would be a very nice tool but I don't know how to go about it.. So, I throw my hands up and see where it leads up to. A final version/product of it would be really nice as I am sure others would appreciate it and make use of it.
just a custom flexgrid table maker/designer thing..
Last edited by Mongoose_MHS; May 26th, 2024 at 06:14 PM.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
I had more in it in the original design.. Where as the same for the alignment for the headers.. You could do the same with the content in each row.. However, the first attempt failed misably.. so with this version I did not get to add the content alignment to each row.. but here is a pic of the first design.
Last edited by Mongoose_MHS; May 26th, 2024 at 08:13 PM.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
I realized rather quickly that I couldn't copy from the richtextbox and I can't clear the richtext box.. that's starts the issues. Then It would take someone like Arnoutdv or someone with same knowledge or experience in finishing this. I just admit defeat cause I know my limitations and I am new so.. Still a nice app to have when dealing with FlexGrids I think anyway.
It works to a point..
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
1.) I "think" I could have used a txt file or HTML file so I could see the green color notes as well as copy the code and paste it elsewhere.. Because with the richtext I can highlight it - but not copy and paste.. not that I know of..
2.) I don't know how to actually code the "alignments" per header and per row.. This takes someone far more advanced than me!
3.) When trying out the richtext.. I can't seem to clear it as it tends to duplicate code if I try not to add "bold text" and then do so WITH it.
Just very frustrating, However I still find it a good concept and tool to have.. Just MY thoughts.
Yeah, WAY WAY BEYOND my capabilities and knowledge sadly. I gave it a run tho.. It's not perfect by any means, but the idea and concept is fully there!
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
I spent the morning working on how to create file shortcuts and set up to run as an administrator, compatible with XP SP3.
I spent three hours on such a small function.
It sometimes takes a lot of time to develop a control or several functions.
Re: I was really excited but now disappointed - FlexGrid tool
I'm not quite keen on downloading project and discover myself what the purpose of the application should be and what needs to be done to get it on track again.
So please explain what the goal and scope of your project is.
Re: I was really excited but now disappointed - FlexGrid tool
I am with Arnie on this one.....NO idea what your project would ever be used for, but, as a teaching event, I decided to rewrite it for you. Note I use arrays, not individual controls...
Re: I was really excited but now disappointed - FlexGrid tool
Do do this correctly, the Flexgrid should be sub-controlled, in the sense of placing it on a custom-user-control, and then making a super-control with the features you'd like to see on your custom-Flexgrid. And then, done this way, you can add your own property pages (or tabs) with the extra features you want. That's why we have custom-user-controls and the ability to make our own property pages.
Another idea (which I haven't explored) is to possibly just write a property page, and figure out how to "invoke" (i.e., show) it, and have it somehow auto-attach to an existing FlexGrid. Not sure how difficult this would be though. I'm not sure I've ever seen a VB6-designed property page invoked without being through a custom-user-control.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Re: I was really excited but now disappointed - FlexGrid tool
Originally Posted by Arnoutdv
I'm not quite keen on downloading project and discover myself what the purpose of the application should be and what needs to be done to get it on track again.
So please explain what the goal and scope of your project is.
Downloading the project or not is totally your choice. I think the picture in #3 pretty much explains the project all in itself.. You make CUSTOM FlexGrids. Headers can be aligned to left, center or right. Same with aligning CONTENT in each row I only mentioned your name cause you seem to have the knack to achieving the above. Again, personally I think it would be a very useful tool. There is nothing to be hesitant in downloading it and see it now that I have explained it.
Last edited by Mongoose_MHS; May 27th, 2024 at 07:53 PM.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
Originally Posted by Elroy
Do do this correctly, the Flexgrid should be sub-controlled, in the sense of placing it on a custom-user-control, and then making a super-control with the features you'd like to see on your custom-Flexgrid. And then, done this way, you can add your own property pages (or tabs) with the extra features you want. That's why we have custom-user-controls and the ability to make our own property pages.
Another idea (which I haven't explored) is to possibly just write a property page, and figure out how to "invoke" (i.e., show) it, and have it somehow auto-attach to an existing FlexGrid. Not sure how difficult this would be though. I'm not sure I've ever seen a VB6-designed property page invoked without being through a custom-user-control.
Again, it's BEYOND my coding abilities as I am new. SO, I went as far as I could go. Hence why I would like to see someone with a lot more experience finish it or make one.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
Originally Posted by SamOscarBrown
I am with Arnie on this one.....NO idea what your project would ever be used for, but, as a teaching event, I decided to rewrite it for you. Note I use arrays, not individual controls...
I think the picture in #3 pretty much explains the project all in itself.. I think the picture in #3 pretty much explains the project all in itself.. You make CUSTOM FlexGrids. Headers can be aligned to left, center or right. Same with aligning CONTENT in each row
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
That's the point of the project.. It generates the FlexGrid code to use in other projects. That's why there is a button "Generate Code" - It opens another form and there's the code to copy and paste into other projects. Or put the code in a module and call it. There is nothing more to the project.
Last edited by Mongoose_MHS; May 27th, 2024 at 04:01 PM.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
Basically a "Plug & Play" thing.. so when you call info from a DB it will align the CONTENT where you said it to go as well as set the headers as you want them to be aligned.. You put the FlexGrid control on the form, set the columns and rows.. and call it. Basically a "Set it and forget it".
Example code for module.. Again, BEYOND me
Code:
'Custom FlexGrid Caller
Option Explicit
Public Whatever1 As String 'If these are even needed
Public Whatever2 As String 'If these are even needed
'More if needed
Public Sub MyFlexGrid()
'align each header as chosen
'align CONTENT from DB in each row as chosen
End Sub
Last edited by Mongoose_MHS; May 27th, 2024 at 04:03 PM.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
Something like this would be in a module - (However, I do know that there is a lot more to it than the following), but at this point I think everyone gets the point of the program: Anyways, I'm just running ideas at this point and hope everyone can read between the lines if I'm not making it clear.. I'll add a temp DB to call info from but that's as far as I can go. I'll also add the row section to sam's zip unless he wants to add it in as it HIS code.. Up to him. but i'' add to the design and upload the zip.
Code:
Option Explicit
Private Sub cmdSetUpGrid_Click() 'So we'll call this in the end as the "Plug & Play" on the form or where ever they are using it
Grid1.Row = 0
Dim i As Integer
If Check1.Value = 1 Then
For i = 0 To 9
Grid1.Col = i
Grid1.CellFontBold = True
Next i
Else
For i = 0 To 9
Grid1.Col = i
Grid1.CellFontBold = False
Next i
End If
For i = 0 To 9
Grid1.Col = i
Grid1.TextMatrix(0, i) = txtHeaderTitle(i).Text
Select Case cboHeader(i).Text
Case "Left"
Grid1.CellAlignment = flexAlignLeftCenter
Case "Center"
Grid1.CellAlignment = flexAlignCenterCenter
Case "Right"
Grid1.CellAlignment = flexAlignRightCenter
End Select
Grid1.ColWidth(i) = txtHeaderSize(i).Text
Next i
'Ok, that does HEADERS.. but NOT the CONTENT alignment per row.....
End Sub
Private Sub ClearIt()
frmCodeDisplay.RichText.Text = ""
End Sub
Private Sub Form_Load() 'Whatever form one is using
Dim i As Integer
For i = 0 To 9
Grid1.TextMatrix(0, i) = txtHeaderTitle(i).Text
Next i
End Sub
Last edited by Mongoose_MHS; May 27th, 2024 at 08:29 PM.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
It generates the FlexGrid code to use in other projects. That's why there is a button "Generate Code" - It opens another form and there's the code to copy and paste into other projects.
If I understand correctly you want to create a tool in which you can define the layout/styles of the grid?
And then you can get a preview? And a generate button to generate the actual VB6 source code?
Like a visual designer or something. If the codes needs to be generated in an open project then the designer would need to be an IDE addin.
I do indeed have a lot of experience with ms/vsFlexGrids, but I never found the need for a grid designer.
Krool created a free to use version of the commercial vsFlexGrid, the vbFlexGrid. This grid has a lot of additional methods and properties to make coding a life much easier and the code used is easier to read.
When I used the vsFlexGrid as an alternative for a Listbox:
Re: I was really excited but now disappointed - FlexGrid tool
As far as content alignment per row...you can use the exact code (post 15 (from my example code)), just change the Row number in some sort of loop. If you want all cells (alignment) in each column to mirror that of the Header row, use ColAlignment instead of CellAlignment.
As far as copy-paste of your generated code, I find it so easy to open a project, copy the code I want directly from the IDE, and paste it into the IDE of my new project. After all, the code is all there already. I sincerely doubt anyone would use your project's 'generated code' to create similar grids in their project...instead, they could simply copy the code 'you' (me) wrote to create a similar grid.
Anyway....I'm outa here as I don't believe this project of yours has any value. Again, MY opinion. Sorry! No need to spend time arguing, just carry on with others' inputs if you like.
Re: I was really excited but now disappointed - FlexGrid tool
Originally Posted by Mongoose_MHS
... a "Plug & Play" thing.. so when you call info from a DB it will align the CONTENT
IMO, what you want (or need) - is a generic (common) routine (and not a "Visual Designer"),
which ensures alignment of certain Columns, according to the DataType of your Recordset-Fields.
Something like this probably - here using a fabricated Recordset without a DB, to simulate Input...
(Project needs a reference to "Microsoft ADO 2.6" and an MSHFlexGrid on an otherwise empty Form):
Code:
Private Sub Form_Load()
Dim Rs As New ADODB.Recordset
Rs.Fields.Append "ID", adInteger
Rs.Fields.Append "Name", adVarWChar, 1024
Rs.Fields.Append "Date", adDate
Rs.Open
Dim i As Long
For i = 1 To 9
Rs.AddNew Array(0, 1, 2), Array(i, "Name" & i, Now + i)
Next
ApplyDataSource Rs
End Sub
Sub ApplyDataSource(Rs As ADODB.Recordset)
MSHFlexGrid1.FixedCols = 0
Set MSHFlexGrid1.DataSource = Rs
Dim i As Long, w As Long, a As AlignmentSettings
For i = 0 To Rs.Fields.Count - 1
w = 1200: a = flexAlignLeftCenter 'set defaults
Select Case Rs.Fields(i).Type 'override the defaults for certain Rs-Field-Types
Case adInteger, adBigInt, adCurrency, adDecimal
w = 1000: a = flexAlignLeftCenter
Case adVarWChar, adVarChar, adChar, adWChar
w = 1500: a = flexAlignCenterCenter
Case adDate, adDBDate, adDBTime, adDBTimeStamp
w = 2000: a = flexAlignRightCenter
End Select
'apply the params, set above in the Select-Case
MSHFlexGrid1.ColWidth(i) = w
MSHFlexGrid1.ColAlignmentFixed(i) = a
MSHFlexGrid1.ColAlignment(i) = a
Next
End Sub
Re: I was really excited but now disappointed - FlexGrid tool
If I understand correctly you want to create a tool in which you can define the layout/styles of the grid?
And then you can get a preview? And a generate button to generate the actual VB6 source code?
Like a visual designer or something.
Yes OR have all the code in a module and I can edit how many columns and rows, alignment for every header and every row. For the most part I want ALL the headers CENTERED, However, I do NOT want every row's CONTENT to be centered. Some row infor I want aligned LEFT, Others I want CENTERED and others I may want right. I would have to be able to control all of that. In the module I could add or remove columns and rows. since there is no module that has all that in it is why I was trying to make this app or have someone help me accomplish it. I guess I just won't use flexgrids and DB's for anything. At the point in why I even bother with Vb if I can't do what I want with it. Glad everyone is more experienced with them.
Anyway....I'm outa here as I don't believe this project of yours has any value. Again, MY opinion
Sorry YOU feel that way.. However, it's a project that I would like to see done and finished. Even if it's for my own use.. Or a fully customizable module as I just mentione above.
Thanks anyways.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
I don't believe this project of yours has any value.
And further more, if I was a MOD on here I would have reprimanded you for saying such a thing! People come here for help and ask for it and comments like that are very discouraging to that person! It would have been best to not have said anything at all. You may or may not like a person's project/idea/concept - (However, it's THEIRS to accomplish, not yours to decide if it's worth any value).. Shame on you and the mods for not saying anything to you about your replies.. As I have seen your replies to certain others and not just me in the same manner.
There is no need to discourage or humilate or otherwise others and that's exactly what you do when you say stuff like that! Like they say "Keep your opinions to yourself" and "If you don't have anything nice to say, don't say anything at all"..
Last edited by Mongoose_MHS; May 28th, 2024 at 10:12 PM.
Monroe High School.. GO HORNETS!
If I've help you, please add to my reputation level! Each reply has a "STAR" icon followed by: "Rate this post".. click that
Re: I was really excited but now disappointed - FlexGrid tool
I understand the need for different alignment and font styles for the header columns compared to the data columns.
You also say the alignment should he based on DB content.
Then the sample Olav gave could be a starting point.
I don’t understand the why of having different alignment per data row.
Do some some columns have a mix of numeric and textual data?
And when you hardcode the alignment per row how do you know which row get filled with what data when querying a DB?
Re: I was really excited but now disappointed - FlexGrid tool
Originally Posted by Mongoose_MHS
And further more, if I was a MOD on here I would have reprimanded you for saying such a thing! People come here for help and ask for it and comments like that are very discouraging to that person! It would have been best to not have said anything at all. You may or may not like a person's project/idea/concept - (However, it's THEIRS to accomplish, not yours to decide if it's worth any value).. Shame on you and the mods for not saying anything to you about your replies.. As I have seen your replies to certain others and not just me in the same manner.
There is no need to discourage or humilate or otherwise others and that's exactly what you do when you say stuff like that! Like they say "Keep your opinions to yourself" and "If you don't have anything nice to say, don't say anything at all"..
In Sam's defense, you mentioned Sam's name in your initial post looking for people to "finish" this. So him chiming in to this thread to turn down your request is completely appropriate IMO. You weren't asking for help, you were asking people to finish what you started.
And I'm with others here, I'm not seeing the use case for something like this at all, so it isn't clear to me what the "finished product" is, does, or how it would be used.
Re: I was really excited but now disappointed - FlexGrid tool
Thanks OB1....as one can see (if they want to) I DID provide an 'almost' solution as requested. But did I get any thanks for that? NOPE. I showed how to use control arrays and to produced what they asked for. So, for me voicing my opinion, I was simply tell them that it makes little to no sense. Instead of letting it drop (and I asked not to get into an argument, but he just had to challenge my stated opinion). They could have simply said that in the their opinion, it is. No need to get nasty!