spacing in textbox

StorM_GmA
01-24-2008, 02:09 AM
Hello!

Is there a way to set the spacing between words in a textbox? I'm making a list in a textbox but it is not single-column, however I want columns to be like lists. In C# there were a way to start a word at the 20th char position for example...
I hope it's clear what I am asking!

Flyguy
01-24-2008, 02:17 AM
Use a mono spaced font.

StorM_GmA
01-24-2008, 02:24 AM
what's that? :confused: I want something like that


test 12345 dasd
testtest 123 dasdas


Because I don't know the length of the words in the first column, I want somehow to start the second column at the 20th char, so the first column can have 19 char spaces to "write" the word! I'm retrieving data from a database...

Flyguy
01-24-2008, 03:04 AM
Using the Format() function you can make sure every word use 19 characters by padding the word with spaces. But you need to use a Mono spaced font, like Courier.

Qua
01-24-2008, 03:06 AM
Sounds like you are better off using a listview set with a Details view.

the master
01-24-2008, 03:19 AM
The listview idea would probably do exactly what you want but if it has to be a textbox then you could use tabs. It would still be hard to get everything to line up properly though because as Flyguy said you need a mono spaced font.

The only alternative i can see is to set your form to the same font as your textbox (they are the same by default i think). Then you can use me.textwidth("your text here"). Check how wide the text is and apply some maths to decide how many tabs to add. Tabs should ensure everything lines up correctly but you still need that bit of maths to work out how many tabs you need

StorM_GmA
01-25-2008, 08:12 AM
thanks alot for your replies! I will try some of your ideas! Can someone tell me how the .EOF is working? It's off topic but I can't use something like data_customers.EOF and I want to include it for creating the list in a While loop...

Flyguy
01-25-2008, 08:34 AM
Ask your database question in the appropriate forum please.
But if you want to display the results of a query on the screen then you should either use the ListView control or a grid control like the datagrid or the FlexGrid.
For FlexGrid samples check out the .. thread

StorM_GmA
01-25-2008, 08:50 AM
ok sorry! I asked in other topic but didn't get answer so I thought I could ask here! But I will create new topic in the appropriate forum! Thanks!

StorM_GmA
01-25-2008, 11:02 AM
well, I tried to find out how to use the format() with strings but nothing...all I found is how to use it with date, time and numbers. Any clues guys?!?!

the master
01-25-2008, 11:28 AM
There is another way to do what Fluyguy suggested. You define a set amount of spaces to have. Lets say 20 for now. You take the length of your string away from 20. If you have 15 chars then the result is 5. Then you use space() to add that amount of spaces to the end of the string.

I know that way works but ive never tried anything like that with format before.

Format() or space() though you still need a mono spaced font. If you want to allow any font then use the method i suggested in post #6.

From what you have said it looks like you are displaying a grid of information from a database. If you are then a textbox is definately the wrong control to use. As Flyguy suggested you should be using a flex grid

StorM_GmA
01-25-2008, 11:36 AM
well in fact I will use a listbox but due some problems we faced in this topic http://www.xtremevbtalk.com/showthread.php?t=291758&page=2
(after post #22) I can't use multiple lists for each item connected to the databse. I will try to do that with the space() and see if it will work!

the master
01-25-2008, 12:21 PM
Thats what the flexgrid control is for. It is basicly a bunch of list boxes side by side but when you select a row on one it will select the same row on another. Just like excel

StorM_GmA
01-26-2008, 05:42 AM
duh now I saw what flexgrid does!!! How do I use a FlexGrid?!

the master
01-26-2008, 06:07 AM
How do I use a FlexGrid?!

Read post #8 again. Flyguy linked to a thread that should tell you everything you need to know

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum