English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hi , i have list box in my program which i use additem function to list items from text boxes , in one line of the listbox i have many info e.g price and quantity , but i can not leave space between them , can anyone help please

alli want to do is list something below

£4.75 , 2 QTY

thank you

thank you

2006-12-21 04:36:41 · 5 answers · asked by Anonymous in Computers & Internet Programming & Design

5 answers

I am assuming that you are concatenating a series of textbox.text values into one string variable with seperator spaces (myStr for example myStr = str1 & " " & str2) . Then using myStr as the added item....

Try using a fixed font like Courier New rather than a proportional spaced font. Its possible the proportional spacing is giving the appearance of not having a space.

Next try either padding string elements with spaces or inserting a vbTab between string elements. This assumes that you have two seperate strings (PRICE & QTY) if not split the string at the comma.

2006-12-21 04:48:55 · answer #1 · answered by MarkG 7 · 0 0

If you want to have multiple values to be a single entry in your list box using a space here are the 2 methods I can think of:

1) Send the ASCII value for space (32) in between your values.
example:

lstListbox.AddItem txtText1.Text & Chr(32) & txtText2.Text


2) Concatenate a space between values
example:

lstListbox.AddItem txtText1.Text & " " & txtText2.Text

2006-12-21 04:49:42 · answer #2 · answered by Cerdle 2 · 0 0

Private Sub Command1_Click() Dim i As Integer For i = 0 To List1.ListCount - 1 If List1.Selected(i) = True Then Form1.Print List1.List(i) End If Next i End Sub

2016-05-23 05:32:57 · answer #3 · answered by Anonymous · 0 0

What you'll need to do is pull the string value and pick out the bits you need by manipulating the string. Think, MID, RIGHT, LEFT, REPLACE, INSTR, TRIM.

For instance, to get the price, trim(mid(string, 1, instr(string, ",") ))

To get the qty it might be trim(mid(string, instr(string,",")+1,50))

The only way this really works is if the data is consistent with the comma, such as given in your example.

2006-12-21 04:55:13 · answer #4 · answered by Anonymous · 0 0

Dim NewList


newList = list1.AddItem(var1,&" "&var2)

That's &, a double quote, a space, another double quote, and another & sign. The &" "& should put a space into the item for you.

2006-12-21 06:04:08 · answer #5 · answered by Richard H 7 · 0 0

fedest.com, questions and answers