Link to home
Start Free TrialLog in
Avatar of wwstudioinc
wwstudioinc

asked on

like values

I have a table that stores data of things to do at various locations it can store up to six locations(location0 to location7) now at each location there can be 3 different thing to be done.what i would like to do is this have 4 text boxes
location     item              item1       item2     now if the items are at the same location then display then on the same line in each textbox else for every different location we would start a new line. eg

location        item     item1      item2
location0        1            2           3
location1                       4         5
location2       6                         7
so at location0 we are going to do all 3 items,at location1 we are only going to do item1and item2 and at location2 item and item3.etc.etc.
thanks
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

It is difficult (but not impossible) to space out text accurately inside text boxes.

I think that you would be better off using, either a grid, or a textbox for each item/location combination.

With text boxes, you could use a control array of 30 text boxes. Simple algorithms could translate the box's index to location and item or vice versa.

Or you could have 3 control arrays (one per item) txtItem0(0), txtItem0(1),txtItem0(2) then txtItem1(0), txtItem1(1),txtItem1(2).

In the same vein, there could be one array per location - txtLocation0(0), txtLocation0(1), txtLocation0(2), txtLocation0(3), txtLocation0(4), txtLocation0(5), txtLocation0(6), txtLocation0(7),txtLocation0(8), txtLocation0(9).
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> I think that you would be better off using, either a grid, or a textbox for each item/location combination.

Maybe because I use it allot, why don't you use a listview for that (like GrahamSkan suggest it) ?
Avatar of wwstudioinc
wwstudioinc

ASKER

guys that for the response but does anyone has an example.i have no clue.I am trying to avoid having to use too many text boxes
Which option do you want code for? The code that I have provided is intended to illustrate how to do what you ask for, that is to space out the text inside a text box so that it resembles columns.
Does that help?
how would you go about using an array for each location
Is the listview with multiple columns a soluction for your ? Do you like an example ?
i have been playing around with something like this but the only problem i would have is to ensure then the vbcrlf falls in the same place.let's say the first line goes pass the width of the text box that a new line would start for that text box which would fall into the same position the other vbcrllf in the same position.

For i = 0 To 7
 
  Me.location  = Me.location  & rs.Fields("location" & i) & vbCrLf & vbCrLf
 Me.txtl = Me.txtl & rs.Fields(" item" ) & vbCrLf & vbCrLf
Me.txts= Me.txts & rs.Fields(" item1) & vbCrLf & vbCrLf
 Me.txth = Me.txth & rs.Fields(" item2i) & vbCrLf & vbCrLf

Next
this is pretty close to what i am looking for
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
My last comment does not address your last comment, which I hadn't seen.
I think you are tryoing to do it the hard way. Text boxes are not designed to display text at given particular XY positions.

The easiest and most obvious way to display a database table is to have a data control and a grid.