ComboBox Complicated List

Multiline Items in Combobox

Page 1 of 1

4 Replies - 3159 Views - Last Post: 14 July 2008 - 04:02 PM Rate Topic: -----

#1 mpretico  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 16-June 08

ComboBox Complicated List

Posted 16 June 2008 - 05:56 PM

||edit: creating in the Office 2003 VB editor

Good evening all,

I'm new to visual basic so I thank anyone for whatever help you have for me. I am creating a form that runs on the opening of a Word template. The form takes the text in the fields and inserts them into their assigned bookmarks.

What I am trying to do is create either a combobox item or split listing with a multiline string of text.

For example,

I would like the combobox to display as an option

Jet1
Jet2
Jet3

And when Jet1 is selected it would insert something similar to the below:

Aircraft Aviation Business Jets Charter, LLC l Charter Services
Chicago Sales Office l 6150 South Laramie Avenue l Chicago, IL 60638 l USA
Tel. +1 773 581 9448 | +1 800 232 5388 l Fax +1 201 624 7338 l www.site.com

I've tried tweaking the below code but I don't know how to break the text into multiple lines.

aStateList = Split(" AL AK AS AZ AR CA CO CT DE DC FM FL GA GU" _
					  & " HI ID IL IN IA KS KY LA ME MH MD MA MI MN MS" _
					  & " MO MT NE NV NH NJ NM NY NC ND MP OH OK OR PW" _
					  & " PA PR RI SC SD TN TX UT VT VI VA WA WV WI WY")
Me.ComboBox1.List = aStateList
End Sub


Any help would be greatly appreciated. Thanks!

This post has been edited by mpretico: 16 June 2008 - 06:13 PM


Is This A Good Question/Topic? 0
  • +

Replies To: ComboBox Complicated List

#2 mensahero  Icon User is offline

  • I Desire...
  • member icon

Reputation: 17
  • View blog
  • Posts: 678
  • Joined: 26-May 08

Re: ComboBox Complicated List

Posted 16 June 2008 - 08:36 PM

I think combo box is not suited for that and there is actually a control that has functionality like that. I just can't remember the name; something like a word with "tree", agh I just can't seem to remember.

But In my opinion I think there is a control for that and doing that with a combo box is really hard and I'll bet its gonna be messy.
Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: ComboBox Complicated List

Posted 16 June 2008 - 09:55 PM

Moved to VB.NET forum.

You need to assign the array to the DataSource property of the ComboBox.
Me.ComboBox1.DataSource = aStateList

Was This Post Helpful? 0
  • +
  • -

#4 mpretico  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 16-June 08

Re: ComboBox Complicated List

Posted 16 June 2008 - 10:05 PM

Thanks for the suggestions. The code i posted does work for the state list as it is but I need to do something more advanced than that. I am interested in more suggestions like the tree listing but also keep in mind that I'm doing this in the Office editor so I don't think it has as much functionality.

Any suggestions would be greatly appreciated.
Was This Post Helpful? 0
  • +
  • -

#5 mpretico  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 16-June 08

Re: ComboBox Complicated List

Posted 14 July 2008 - 04:02 PM

I decided instead to make the combobox value equal three strings and to have a label's caption change when the item was selected. That is how i got past the multiline text in the combo box. Thanks for all of your help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1