|
-
Sep 17th, 2002, 07:27 AM
#1
Thread Starter
Addicted Member
Combo Box
I have a problem regarding combo box
When i add 2 columns in a combo box how can I align them properly
i have used combo.additem rs(0) & " " & rs(1)
the output is as :
abcdefgh This is my first rec.
abcd this is my second record
ab this is my third record
So you see the 2nd column is not aligned in a straight line.
I have even tried adding spaces , calculating length og rs(0) and adding spaces accordinglr but to no avail.
Please advise
thnks
-
Sep 17th, 2002, 07:38 AM
#2
PowerPoster
Try using this instead:
combo.additem rs(0) & vbTab & rs(1)
Roy
-
Sep 17th, 2002, 08:30 AM
#3
Thread Starter
Addicted Member
combo box
The vbtab does not work
because
the font size of space is less than the font sizze of say letter"Z"
hence even if i add 5 spaces = 1 tab then also it does nort work
Pls advise
-
Sep 17th, 2002, 08:50 AM
#4
PowerPoster
Not true. get TextWidth or Len of a longest value for a Field1 and add vbTab to it. As simple as that.
-
Sep 17th, 2002, 08:52 AM
#5
PowerPoster
Also, you better use True type font for your combo (Arial, Courier, MS Sans Serif, etc)
-
Sep 17th, 2002, 09:14 AM
#6
Thread Starter
Addicted Member
Combo Box
I have tried using
combo.additem rs(0) & vbtab & rs(1)
My output in the drop down combo box is as
abcdefg|this is my first record
abc|this is my second record
abcdefghij|this is my third record
My rs(0) is varchar2(12) i.e. it can accept upto 12 characters.
my rs(1) is varchar2(20) ..... 20 characters
I am using Ms Sans Serif font ... font size = 8
As you can see if the user enters say only 3 characters in rs(0)
ALWAYS then I dont have a problem but when his entry of characters is random the 2nd column does not align itself properly.
Please advise as I am a student doing a project and have
used the combo box in most of my modules
P.s. Is there any chance that without changing my code I can use
imagecombo box for these alignment of columns
-
Sep 17th, 2002, 10:36 AM
#7
Thread Starter
Addicted Member
Now help me in the above query Please
I am doing aproject and am stuck in this mess
-
Sep 17th, 2002, 10:38 AM
#8
Frenzied Member
EITHER use two combo boxes very close to each other.
Or look at using the ListView object, in report format.
Look in this forum for many examples.
-
Sep 17th, 2002, 10:40 AM
#9
Fanatic Member
alternatively, use the Microsoft Forms 2.0 Object Library. that has a combobox in that supports multiple columns.
-
Sep 17th, 2002, 10:46 AM
#10
Try adding spaces to fill the maximum length:
combo.additem rs(0) & string(12-len(rs(0)),32) & vbtab & rs(1)
string(x,y) returns X characters of code Y (32 is space)
-
Sep 17th, 2002, 10:50 AM
#11
PowerPoster
Try this but KIM that your loop may look different:
VB Code:
Dim i%, strText$, strF1$, strF2$
For i = 0 To 9
strF1 = "Item" & i & "_Col1"
strF2 = "Item" & i & "_Col2"
strText = strF1 & Space(12 - Len(strF1) + 4) & strF2 'we add 3 extra spaces in case len(strF1)=12
Combo1.AddItem strText
Next i
End Sub
Roy
-
Sep 17th, 2002, 10:53 AM
#12
PowerPoster
Use of Microsoft Forms 2.0 Object Library REQUIRES ADDITIONAL LICENSING. You CANNOT distribute this controls freelly.
Roy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|