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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxPro List Box

Status
Not open for further replies.

VFP2013

Programmer
Oct 19, 2013
20
US
Ok, So First off i'm new here.
Hi, I'm having trouble with making a list box in my foxpro program, it is for a dry cleaners program, you enter the customers last name, it searches a data base for that inputs all the last names and first names along with the customer number into a combo box in the format <CustNo>: <Last>, <First>. Now, I have a listbox on the same form, where once a customer is selected from the box and we have the customer number, it should search the orders database for all of the un-picked-up orders with that customer's number in the custno field and put them all in the multi-select enabled list box, once you select all the orders you want to pick up you would then push the pay button, where it will total the amounts and mark them as gone. I need help with searching the table to get the active orders and put them in the listbox. I'm also having another minor problem, which is when you put in the customer's last name it only puts 2 rows of names in the list box. PLEASE HELP!
Also, If you're interested, I would like somebody who could teach me a little more about foxpro.
 
I would strongly suggest that you NOT use listboxes.. instead look at the FoxPro Grid. Where you can control it better, add check boxes to it, add cursor to it, make headers for it etc..

Basically, put a grid on the form, set the # of columns, fonts, and headers you wish.

in the method where you get the orders:

Sample code.
Assuming you name your Grid, grdPendingOrders... and your select statement might look something similar to this...

Code:
Thisform.grdPendingOders.RecordSource = ""

Select ;
  CustNo,;
  OrderID,;
  OrderDt,;
  OrderAmnt,;
  ItemCount ;
From YourOrderTable ;
   where custno = thisform.txtcCustNo.value ;
  and OrderStat = 'U' ;
   order by OrderDt Asc ;
into cursor curUnPicked

thisform.grdPendingOrders.RecordSouce = "curUnpicked"
1

Ez Logic
Michigan
 
One more thing.

Make the cursor ReadWrite like this:

select ;
Field1,;
Field2, ;
etc..,;
.f. as lPickUp ;
from Yourtable into cursor curPendingOrders readwrite.

Add a check box on the last column of the grid. Make the sparse property of that column to .f. and make the current control to the checkbox and not the textbox.

then, when the user clicks the checkbox, basically the the lPickup field is turned to .t.

then, you can do:

sele curPendingOrders
scan
lcOrderID = OrderIDFiled
if !lPickup
loop
endif
thisform.PickupOrder(lcOrderID)
endscan

Thisform.GetPendingOrders() && to refresh the orders from the customer's unpicked orders...
or something like this...


Ez Logic
Michigan
 
Thank the LORD That he sends wonderful people like you 2 Down!
THANKS!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top