Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataEnvironment
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00720068
Message ID:
00720102
Views:
14
Jose, I thought I would place this code up here for anyone who might want to look at it.

****************************************
** CBOCHANGEPATH LOSTFOCUS EVENT *******
****************************************
* This combo box is set up to give the user access to different paths for his data.
* Cecil Champenois 11/07/2002.
WITH ThisForm
DO CASE
CASE This.ListIndex = 1 && C:\CONTACTS\DATA\
lcPath = .aTablePath[1,1] && Array containing above path.
CASE This.ListIndex = 2 && C:\CONTACTS\SPL1\
lcPath = .aTablePath[2,1]
ENDCASE
* This next property is very important. If you do not want a lot of bad behavior from
* Visual FoxPro, you must set the grid's recordsource property to space(0) or "". I was
* able to eliminate all of the below grid property settings by this one simple setting.
.grdContacts.RecordSource = SPACE(0)
* Close the current table.
SELECT (.cTable) && Go to the work area of the current table.
USE
CLOSE DATABASE && Close the table.
SET PATH TO (lcPath) && Set the new path, as selected by the user.
.DataEnvironment.Cursor1.Database = lcPath + "CONTACTS.DBC"
.DataEnvironment.Cursor2.Database = lcPath + "CONTACTS.DBC"
* I had to add the path into the opening command in order to ensure that the correct
* table was opened. Cecil Champenois 11/07/2002.
USE lcPath + (.cTable) IN 0 && Open the newly selected table.
SELECT (.cTable) && Go the table's work area.
=CURSORSETPROP("Buffering", 5, .cTable) && Set new table to Table Buffering.
.grdContacts.RecordSource = (.cTable) && Add value of the new RecordSource.
SET ORDER TO LASTNAME && Set the Index Order to the default.
GO TOP
USE lcPath + "SYMPTOMS" IN 0
* Don't need the below code because I reset the recordsource to space(0) first,
* then gave it it's true value thereafter. Cecil 11/7/2002.
*!* * Refresh the grid.
*!* .grdContacts.ColumnCount = 2
*!* .grdContacts.Column1.Width = 240
*!* .grdContacts.Column2.Width = 349
*!* .grdContacts.Column1.ControlSource = "pgcontacts.firstname"
*!* .grdContacts.Column2.ControlSource = "pgcontacts.lastname"
*!* .grdContacts.Column1.Header1.Caption = "First Name"
*!* .grdContacts.Column2.Header1.Caption = "Last Name"
*!* .grdContacts.Column1.Header1.FontBold = .T.
*!* .grdContacts.Column2.Header1.FontBold = .T.
.lblPath.Caption = SET('PATH')
.Refresh()
ENDWITH
Previous
Reply
Map
View

Click here to load this message in the networking platform