Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem displaying data in grids. 1

Status
Not open for further replies.

112055

Programmer
May 13, 2002
61
US
Hello,
I have a form that contains 4 tabs(tabSetup SStab). Inside each tab contains a List SSDBGrid. The arrangement is Tab 0, Tab 1, Tab 2, Tab 3. For some reason, everytime when I run the Application, I open this 'Setup.frm', the Tab 0 page's datagrid looks like it does not contain any data, but if I move the grid rows a bit with the mouse, the data is there. It only happens to the first Tab page.
Any idea to make the data shows up properly? All other Tabs display the data in the grids readily without having to adjust the grid.

Thanks,

Ann
 
Where do you have the code positioned within the form to populate the datagrids? Is it in the datagrid_getfocus or the form_load sub? It sounds like the datagrids are not filling until one of them is clicked upon.

BB
 
Further to BiggerBrother's thought: put a Debug.Print of the content of one of the datagrid cells in two locations, 1) at the end of the Form_Activate event and 2) at the end of the datagrid Scroll event.

"Life is full of learning, and then there is wisdom"
 
BigBrother, koala15,
Thank you for both of your reply.

I tried the suggestions by putting in some debug statements. Here is the findings.
MsgBox shows up in this order ...

here 2 ...nothing
here 1 ...nothing
here 3 ...nothing
here 1 ...nothing
here 3 ...nothing
here 1 ...nothing
here 3 ...nothing
here 1 <.....after clicking on the OK button on this msgBox this time the data shows up on the datagrid by itself. I what is blocking to wait for the # of iterations to finally display the data??
------------------------------------------------
This is the piece of code inside the datagrid
--------------------------------------------------
Sub Listx_InitColumnProps(Index As Integer)

MsgBox ("Here 1??")

Listx(Index).Columns(0).Width = 645
Listx(Index).Columns(1).Width = 2930
'cannot put Listx.Refresh, the choices are count, item, LBound, UBound none of them is helpful

End Sub

----------------------------------------------------
To load this Setup.Frm
-----------------------------------------------

Sub Form_Load()
Dim i As Integer

SetDatabase Me
CenterMDIChild Main, Me

tabSetup.ForeColor = &H404080

MsgBox ("here 2 ??")

If Not ASK And ASKMaster Then 'Disable Tabs for UnAuthorized

tabSetup.TabEnabled(0) = False
tabSetup.TabEnabled(3) = False

End If

Set ComControl = Main!Com
End Sub

----------------------------------------------

The following is the piece of code inside the Datax(0) Data, from 0 to 3 for the 4 tabs pages
-------------------------------------------------
Sub Datax_Reposition(Index As Integer)
Dim i As Integer, X As Integer

MsgBox ("Here 3??")

If Index <> txAgents Then Exit Sub
If Datax(Index).Recordset.EOF Then Exit Sub

If IsNull(Datax(Index).Recordset("ASK")) Then
Datax(Index).Recordset("ASK") = 0
End If
X = Datax(Index).Recordset("ASK")

ASKSet = True
chkASK(0) = X And 1
chkASK(1) = X And 2
chkASK(2) = X And 4
chkASK(3) = X And 8

txtAgentPwd = Decrypt(CStr("" & Datax(Index).Recordset("Pwd")))

ASKSet = False
End Sub
-------------------------------------------------

Any help will be grateful.


thanks,
Ann
 
Ok..back to this headache again..hope some one out there help me out here. I put debug statements in the code to track the bug down but is not give me a clear hit here.

1) I noticed that whichever tab page I left open and go hit run the Application, that will be the Tab page that opens up. So first can someone tell me how to set it so that the 4 tab pages I have ..Tab(0)= Dealer, Tab(1)= Hardware, Tab(2) = Agents, Tab(3) = Lienholder should always open in order, 0,1,2,3...it should not have bearing where I left the tab pages open in the Dev Environment.

2) Now, depends which Tab page it opens up after I hit Run the App, that will be the SSDBGrid without data showing. I have to drag the gridlines down a touch to display all data. This baffles me intensely. With all the VB Wiz out there must be a way to solve this.

I will be so appreciative of your help.

Ann
 
Ann,

1) the ssTab control has a property "Tab", which is zero based and should be consecutive, but does not have to be. At design set the logical first tab to 0, second to 1 etc etc. Then in the activate event of the form use "ssTab1.Tab = 0", this will ensure that the first tab opens everytime.

2) re having to drap down the grid line a touch: create an autosize, invisible label, with appearance = "Flat", then in Form_Activate (not Form_Load) event populate the .Caption of that label with every letter of the alphabet (upper & lower case) as well as the 10 digits (0 to 9) and any other characters you think may be entered by the user. The label will auto resize. Using the .Height property set the grid's .RowHeightMin property to this value PLUS a fudge factor to take care of the grid's internal cell border (if any)

I use a similar technique to set the minimum column width, where each column heading could contain dynamic info (say people's names) and I want each column to be the same width (better looking) and that width will be the width of the longest name.

Cheers.

&quot;Life is full of learning, and then there is wisdom&quot;
 
koala15,
Sorry I am asking you again, for # 2 are you suggesting me to add a piece of code inside the Form_Activate Event, if so can you show me how you do yours?
Sounds crazy, I am asked to convert from VB 3 to VB 6, and VB 3 code works fine the way it is and not in VB 6.

Thanks again,
Ann
 
Ann,

OK:

1) Create an a label control on your form with AutoSize=True, Visible=False and having the same font characteristics as the font used in your datagrid.

2) In the Form_Activate event place all the characters I mentioned into the .Caption property of that label. (An easy way is to use a For loop and use the Chr() function)

3) Set the Me.ScaleMode property to VbPixels. Set the .RowHeightMin propery of the Grid to Label.Height + "Factor". Start "Factor" at say 5 pixels and then vary it depending on the results.

Does that assist you? Cheers.

&quot;Life is full of learning, and then there is wisdom&quot;
 
koala15, I just want to say thank you for all your patience and staying with me on this "ordeal" ..lol...thanks again.

Ann
 
Ann,

You are welcome, please post your success or otherwise.

The technique I suggested for the row height can also be used for the column width as well. For example, if you need to put, say, months of the year into the column headings but for cosmetic reasons you want every column to have the same width, being the width of the column with the longest month name.

Cheers.

&quot;Life is full of learning, and then there is wisdom&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top