o
k
q
u
e
s
t
i
o
n
s
.
c
o
m

Modules, FlexGrid, Wend and controlbox -

Ok, Here we go, Using "Si_the_geek's" FlexGrid_AutosizeColumns code I placed it into a module to use with all the flexgrids that will be in this program on the different forms, but I can't seem to get it to work. What am I forgeting to do to make this work? I'm putting the code
Code:
FlexGrid_AutoSizeColumns MSFlexGrid1, Me
in the flexgrid code section of each form and changing the name of "MSFlexGrid1 to the name of each flexgrid. I know it is something simple that I'm just over looking.
Code:
Public Sub FlexGrid_AutoSizeColumns(ByRef pGrid As MSFlexGrid, _
                                    ByRef pForm As Form, _
                                    Optional ByVal pIncludeHeaderRows As Boolean = True, _
                                    Optional ByVal pAllowShrink As Boolean = True, _
                                    Optional ByVal pMinCol As Long = 0, _
                                    Optional ByVal pMaxCol As Long = -1, _
                                    Optional ByVal pBorderSize As Long = 8)
'Set flexgrid column widths to the minimum for viewing all text
 
'Note that this will not be accurate if Cells have different fonts,
'or if .FontWidth (or .CellFontWidth) has been set
 
'Parameters:
'  pGrid              - the grid to work with
'  pForm              - the form the grid is on
'  pIncludeHeaderRows - whether to take the width of text in FixedRows into account
'  pAllowShrink       - allow column widths to get smaller than current?
'  pMinCol            - the first column to work with
'  pMaxCol            - the last column to work with (-1 means the right-most column)
'  pBorderSize        - the number of pixels used as a border around text (seems like 8 to me!)
 
Dim lngMinCol As Long, lngMaxCol As Long, lngCurrRow As Long
Dim lngMinRow As Long, lngMaxRow As Long, lngCurrCol As Long
Dim lngMaxWidth As Long, lngCurrWidth As Long
Dim fntFormFont As StdFont
 
                            'Store current form font (so can restore later)
  Set fntFormFont = New StdFont
  Call CopyFont(pForm.Font, fntFormFont)
                            'Set font of form to same as grid, to get accurate values
  Call CopyFont(pGrid.Font, pForm.Font)
 
  With pGrid                'Set rows/columns to check
    lngMinCol = pMinCol
    lngMaxCol = IIf(pMaxCol = -1, .Cols - 1, pMaxCol)
    lngMinRow = IIf(pIncludeHeaderRows, 0, .FixedRows)
    lngMaxRow = .Rows - 1
                            'For each column in specified range..
    For lngCurrCol = lngMinCol To lngMaxCol
                                                '..set min allowed size based on options
      lngMaxWidth = IIf(pAllowShrink, 0, pForm.ScaleX(.ColWidth(lngCurrCol), vbTwips, pForm.ScaleMode))
 
      For lngCurrRow = lngMinRow To lngMaxRow   '..find widest text (in scalemode of the form)
        lngCurrWidth = pForm.TextWidth(.TextMatrix(lngCurrRow, lngCurrCol))
        If lngMaxWidth < lngCurrWidth Then lngMaxWidth = lngCurrWidth
      Next lngCurrRow
                                                '..as the scalemode of the form may differ, convert to twips
      lngMaxWidth = pForm.ScaleX(lngMaxWidth, pForm.ScaleMode, vbTwips)
                                                '..resize the column as apt (with specified border size)
      .ColWidth(lngCurrCol) = lngMaxWidth + (pBorderSize * Screen.TwipsPerPixelX)
    Next lngCurrCol
  End With
                            'Restore form font
  Call CopyFont(fntFormFont, pForm.Font)
 
End Sub
 
 
Public Sub CopyFont(ByVal pFontFrom As StdFont, ByRef pFontTo As StdFont)
'Copy the properties of a font object to another
 
  With pFontFrom
    pFontTo.Bold = .Bold
    pFontTo.Charset = .Charset
    pFontTo.Italic = .Italic
    pFontTo.Name = .Name
    pFontTo.Size = .Size
    pFontTo.Strikethrough = .Strikethrough
    pFontTo.Underline = .Underline
    pFontTo.Weight = .Weight
  End With
 
End Sub
And last but not least I read on here somewhere but can't find it now a different command to use that is better than using Wend. Anyone remember what it was, or where I saw it on here?One last question, I hope, I ran into a problem late last night with my program when I hit the close button on the forms it works correctly, closing the form and loadin the main form back up, but when I hit the x on the controlbox it closes the form and that is all. The program is still running but the main form doesn't reload how do I get the x to do the same thing as the close button or shut down the whole program?

 

controlbox -
Other than rigging with API's.. is there a way to have an Icon the taskbar for your forms that have the controlbox set to false... or even so, is there a way to disable the 'X' button or the min and max buttons and just use the controlbox for its icon purposes? Thanks -Matt


Controlbox = False in real time.... HELP ME! -
Hello, I was wondering if you guys could help me out a bit. I've been searching for a while, and couldnt find a soultion that worked how i wanted on this form. Basically what i want to be able to do is deactivate and reactivate the whole ControlBox (the min, close, max buttons a


Show caption in taskbar without controlbox -
Hey. i set my form's ControlBox to false. When i'm minimazing the form to taskbar, the caption is empty, cuz i set controlbox to false. is there a way to show the caption, or soemthing else in the taskbar, without showing the controlbox?


controlbox help -
how to change the presence of controlbox at run time? like at runtime i don't want the control box to appear


Access update -
I want to be able to close a form that have text, combo etc bound to field on a table not to update when the user use the X in the controlbox on the form. This is in Microsoft Access 97. I try using properties and place a no in the controlbox. I try code it in form load etc. But it lik


Controlbox Manipulation -
Yo, is it possible to manipulate the controlbox of the form (with api's or something) so you can put your own buttons next to for example the x? without having to create your own toolbar? I've seen it happen in alot of programs... Thnx


FullScreen mode -
Hi all, I use the following code to get to FullScreen mode: With Me .WindowState=FormWindowState.Maximised .Text="" .ControlBox=False End With This achieves the desired effect BUT.... when I try to close the form with code, it keeps re-ope


Form ControlBox -
Hey all i set my form controlbox to false, and i add 4 images to the form: 1 for the X (close), 1 for the Min button (_) and 2 images which r the title of the form. Now, when the form loses focus, i want image1 b visible, and when the user gets back to the form, when the form is in


[2005] Checking for ControlBox Click -
How do I check to see if a user clicks the "X" (ControlBox) in the top right corner of a form to close it. Thanks,


Responding to Events on a forms controlbox. -
Does anyone know how to respond to a click on a forms controlbox. ie: I have an MDI Parent form, which I don't want to close without prompting for confirmation. This works when the user exits via the exit function I have put on the main menu, however a user can still close the form by


MDIChild controlbox -
Hi all! I open a Form as Child to my parent Form and want to open it without the ControlBox. I have set the ControlBox, MinimizeBox and MaximizaBox property to false and they are not shown if I open the Form as a normal Form, but they are still shown if my Form is opened as a MDIChi


AAAAAAAAA(rg)!! MODULES!! -
Where can I get them? I mean, all of you guys get very good modules from everywhere. But I have no idea from where. Is there a site with a lot of modules or sumthin? I need modules for like mp3s and such.


disable one control in controlbox -
how can you disable just one of the controls in a controlbox? ie. the maximized button only? Can the state be changed only, greyed out? or can it be removed?


Modules...what are they -
What the heck are modules? After a year of VB6 programming my teacher never once mentioned modules... come to think of it, we didnt learn much, heh. What's a good book that will teach me about data-types and modules and pretty much everything else VB? Thanks a lot


4th button to controlBox -
we all have seen apps like getright that have a 4th button to controlBox a button with a '.' that sends the app to tray how do thay do that any examples thnks


Can a set of modules be converted to Active X exe -
Hi there, Ok, I'm relatively new to using and creating Active x exe's and I was wondering something. If I have more then one VB project that uses the same set of modules, I believe there are 18 modules, can I create an Active x exe, or dll, so I don't have to reuse the modules in


Can a set of modules be made into Active X exe -
Hi there, Ok, I'm relatively new to using and creating Active x exe's and I was wondering something. If I have more then one VB project that uses the same set of modules, I believe there are 18 modules, can I create an Active x exe, or dll, so I don't have to reuse the modules


How many Modules can be used -
I am connecting data reports by code. and all the codings are stored in several modules and calling them through appropriate forms. My questions are, if all modules will be loaded into memory when starting my program, will it cause any malfunctions? or will it struck? what i


controlbox not visible -
hi i want the "X" to disappear from the form when i click on a menu: Private Sub faq_Click() help.Show Delta.ControlBox.Visible = False End Sub help please


MSH Flexgrid........... -
Hi Gurus, am newcomer in this field. I Have Used MSH Flexgrid on my form. there is one popup menu where u enters item Details.On Add Button it Should save on first row of MSH Flexgrid. Before that i have Used MS Flexgrid.Can anyone guide me for Using MSH Flexgrid Thanks.....


Removing title bar and control box during runtime -
Hi there! I want my form to display the Titlebar and Controlbox when the mouse is over it, and then for them to disappear when you move the mouse away. Of course, you can't set the ControlBox property of a form at run time - but there must be some API related way to do this.. can


How to set caption... -
I have a form, where i have set the controlbox to off, and the ShowInTaskbar thingie on. What i want to do is being able to set a caption for the form, which is only visible in the taskbar, thereby making the controlbox remain invisible. Does anyone know how to do this ?? Cheers !


classes and form modules -
Hi, What are class modules and what are form modules? What is the difference between the two? I have always used form modules u know (the file extension is .BAS). I've written many functions and sub that i would later use in many areas in my project. When people talk about cla


modules vs class modules -
hey y'all, i was just wondering if you guys could help me out by explaining what the difference between modules and class modules are. what are the pros/cons of each. thanks a lot -rishi


Re-Modules -
Hi, Somebody help me in modules. I am new to modules. pls explain with some examples saying that where we can use modules Danasegarane


Are you over a flexgrid -
If I click on a flexgrid, I can tell which row I have clicked on using MSFlexGrid.Row However, if the Flexgrid only has a few rows in it so far (it is dynamically populated a row at a time by another function) and you click off the bottom of the flexgrid table - but still on the fle


link flexGrid with database table -
I've worked with the dbGrid using Data control. Hare I cannot use any Button to modify any row. So now I am thinking about flexGrid. How can i connect a flexGrid with a access table? Can I use access 2000 with flexGrid? Can I use access 97 with flexGrid?


Inserting, Saving Records From Flexgrid To Database(access..) -
Dear Frnds, I M Using Ms Access And Vb.6.0. I Want To Insert Records In Flexgrid And Saving Records Into Table.. So How Can I Use Flexgrid.. Simply, I Have To Save , Insert Data Into Flexgrid.. I M Student And I M Developing One Software On Bank Test Key S/w. So Plz Help Me..


No icon but [x] button -
Hi, Is it possible to set the Controlbox property for a form to False, but still have the [x] button in the caption bar? Because if I set the Controlbox = False, then the X button also disappears.... Thankx, CJ


having controlbox close (X) do same as a cancel -
I was wondering if there was a way to "listen" to a controlbox close event....in order to have it essentially do the same thing as when a user hits the cancel button on my form.... Any help would be greatly appreciated... Thank You Nightfox02


Modules and Class Modules - simple link -
Hi all I'm having great difficulty understanding the relationship/differences between Modules and Class Modules! My main head scratchers are: When would you use one over the other? Why would you use one and not the other? should you use one over the other in a given situ


Modules Collection in Access 97 **Resolved** -
I am trying to write an Access 97 add-in that will read the lines of code in a module and look for certain keywords. I am having difficulty with the modules collection however. I am trying to list the existing modules in the database, but the modules collection only contains the open


flexgrid to recordset -
Hi all. I am having a problem to store data from flexgrid into a database. Here, I attach the print screen of my flexgrid. I want my database will look as same as the flexgrid. How to do this? Is there any possible way to do this? Please give me some ideas or reference


Flexgrid control question -
I'm using a Flexgrid to display the values of an array. At the bottom of the Flexgrid I am adding all the columns up. I would like to just have the bottom row of the Flexgrid displayed in Bold but have not been able to figure it out through searching on here and on my own. Thanks in


creating a pop-up menu -
how do i create a manual popupmenu? im working with shellnotifyicon, and it want a menu to pop up when i right click my shell icon(which i know how to do)...but my form isnt supposed to have any clipcontrols or controlbox...but if i makea menu using vb's built in menu maker...it makes


Modules, FlexGrid, Wend and controlbox -
Ok, Here we go, Using "Si_the_geek's" FlexGrid_AutosizeColumns code I placed it into a module to use with all the flexgrids that will be in this program on the different forms, but I can't seem to get it to work. What am I forgeting to do to make this work? I'm putting the co


flexgrid again..pls help -
how to save keypress data entry in the flexgrid cell to the database(ms access)? here, i enclose my flexgrid screen (flexgrid.jpg) fill with data..tq jus for info,the columns are fixed and the rows depend on variable. is that possible for this operation??


.Net (2005 & 2003) Simple MDI forms question -
Hi everyone... I'm having a bit of an interface problem, regarding MDI parent and child forms. in VB6, you can set the controlbox/caption etc of the child form to nothing, maximize the form, and it will just appear to "paint" the MDI form. I do this for the ease of d


Help with flexgrid row and column sizing -
Dear all, I am new using flexgrid. I want to be able to resize the columns and rows in flexgrid by code. How can I do it? Secondly, I want to use bitmap images in the grid cells. How do I address a cell in the flexgrid and put a picture into it. It was easier when I used MS Grid


Tell me about classes -
HI! I want to know why it is good to use a class file in VB. I dont really understand it. I use Modules, and Modules.. and modules.. What's the difference?