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

Display data in multiple textboxs 1

Status
Not open for further replies.

ictoo

Programmer
Sep 3, 2009
33
GB
Hello,

I’ve come to a point in my current project where I am stumped, I’m not sure if I’m going to right way about it or I’m trying to do stuff out of my league.

Here is my problem, I have one table that data gets pooled to now this is a lot of data that is going to need to be sorted and then displayed in grids or single values displayed in text boxes, I’m going to us indexes to filter the data and then do whiles to point to the correct record I want by doing

SELECT"epamonitor2"
GO BOTTOM

DO WHILE ALLTRIM(tagname) !="tagnamething"
SKIP -1
IF BOF()
MESSAGEBOX("Error, Could not find file.","End of File",64,1)

ENDIF
ENDDO

Now I’m not sure if this is the best way, but it seems to work in the command window… but what I need help with is displaying different values in multiple text boxes on the same page, I I’m not sure if this is simple and I’m just making more work for my self, but I’ve spent all week on this now and I feel like I’m going crazy.

Thanks for any help you can give me and sorry if this is hard to understand.
 
I don't get what you want to display in several text boxes. I assume you want to show several fields of the epamonitor2 table.

Well, either you add a grid and set it's recordsource to "epamonitor2" and then navigate to the correct record, or you add single textboexes and set each of their controlsource properties to a single field, eg "epamonitor2.tagname" could be the controlsource of the textbox showing the tagname field.

What you can do is create a form (CREATE FORM) then right click besides it to get to the dataenvironment, add the epamonitor2 table there and then drag all the fields you want to show to the form, which will generate textboxes and a label for each field. The textboxes are then already configured to show that field.

Your search code can then be simplified by a SEEK, if you have or create an index on the tagname field. Do that in the table designer and give that index the name "xTagname" (for example), then in the Form Init or a button click do:

Code:
IF NOT SEEK("tagnamething","epamonitor2","xTagname")
   MESSAGEBOX("Error, Could not find file.","End of File",64,1)
ENDIF

Bye, Olaf.
 
Ok I understand that and have something to that extent, now how would I make multiple text boxes show the same field call is epamonitor2.value1 but for different records as the table is getting sent data all the time so I would have to go bottom on the table the skip -1 tell it finds the latest record.

For example I want to show hour run of machines in the show floor so the values are sent to the table every hour and then I want to text boxes to show these times for each machine on the tab WorkShop1 so its not as easy as just setting a text box to that value.

If you could point me in the right direction, what I’m thinking for it seems to be along work around, and there much be an easier way.
 
Each alias has a record pointer to an active record and there can't be several record pointers at the same time in the same alias, but you can use tables ALIAS an alternative alias and then point to anther record there.

Multiple textboxes showing the same field but from the different aliases then would show different records.

And the other thing showing multiple records of the same table is of course a grid. Why don't you want to show data in a grid?

Bye, Olaf.
 
Ok I’ll look in to ALIAS, thanks.

My boss wants the textbox’s because he wants to have a quick glance at each machine and the hours run, he then wants to be able to have another textbox next to the one linked to the data so they will compare and when the hours goes over the number set in the other textbox a message will pop up and ER will be created telling them that it needs to be looked at/maintenance.

Ive done some very simple programs with foxpro ive only started using it about amonth ago so this is the most advance program i think im going to be doing, so all the help you could give would be nice. Thanks again.
 
To be more precise. To be able to show two seperate records, same field in two textboxes, you need

SET EXCLUSIVE OFF && or you can only open a table once!
USE sometable ALIAS sometable1 [ORDER ...]
USE sometable ALIAS sometable2 AGAIN [ORDER ...]

Then you can locate or seek or skip to two different records and show them.

The different aliases are needed, as each alias is the unique name of a workarea and without the ALIAS clause VFP would try to use the same alias, which causes "Alias in use" error. The AGAIN option is needed to prevent the error "File is in use", even if you open a table with a different alias and shared this error would be thrown without the AGAIN option.

You're also able to put a table into the dataenvironment twice and that will take care to give the second workarea a different alias name.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top