Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

VB6 multiline Listbox


  • Please log in to reply

#1
scozzard

scozzard

    Member

  • Member
  • PipPip
  • 26 posts
Is there anyway to make a listbox entry multilline? Theres no true/false listbox multiline property...
Eg. iv tryed:

Form2.lstInput.AddItem cboInput1.Text & vbCrLf & "Infomation"

and iv tryed:

FOrm2.lstInput.AddItem.cboInput.Text & vbEnter & "information"

but these dont seem to work...

Does anyone know how to multiline a listbox?

thanks!
  • 0

Advertisements


#2
dsenette

dsenette

    Je suis Napoléon!

  • Community Leader
  • 26,047 posts
  • MVP
do you mean a list box with different options on each line as if it were a drop down menu? or do you mean a list box with the capability of having an entry long enough to continue on down to the line below it..that counts as one entry not two seperate ones?
  • 0

#3
scozzard

scozzard

    Member

  • Topic Starter
  • Member
  • PipPip
  • 26 posts
Iv got two sets of text from two locations, a combobox control and a label. What im trying to do is combine the cboInput.Text and value from lblOutput.Caption to create an entry in the listbox looking something along the lines of...

Humidity 'from cboInput
56% 'from lblOutput

So that in the list box, there will be an entry that is two lines long

If tried this and it doesnt work...

Form2.lstInput.AddItem cboInput1.Text & vbCrLf & lblOutput.Caption

Any ideas??

thanks for the reply earlier
  • 0

#4
dsenette

dsenette

    Je suis Napoléon!

  • Community Leader
  • 26,047 posts
  • MVP
so...let's say that you're making a weather deal

and you want the user to input what they want to know...and it will then display that info?

by your description the program would go something like this

user selects humidity...and today's humidity is 56%...and you want it to show in a list box

humidity
56%

?

why not just have the combo box set up with the lists of what items to choose
then just have it change the .caption property of the lable

something like

if lstbox1 = humidity
then lbl.caption = inthumidity (wherever you're getting that number from )?

then (in theory...it's been a while since i've done this so the syntax may be way off)...when they click on humidity...that lebel will automatically change to the number
  • 0

#5
scozzard

scozzard

    Member

  • Topic Starter
  • Member
  • PipPip
  • 26 posts
Yea but im making a thermodynamic calculator which is proving a real [bleep] but im done with the calculations thank god, (il give you a run down) as results are computed from two textbox inputs they are displayed 4 output labels. Each of these inputs and outputs are related to one of 6 variables in corrosponding 6 comboboxes.

The reason this situation comes about is cause the user can additems to a recordset, ie, 6 listboxes. When the user selects "add record" from the menu each value and its corrosponding cbo text is recorded in 6 listboxes on another form. But because the selected position of inputs and outputs alter according to what the user selects I need the combotext too appear above the result (text showing in the labels). So essentially 6 listboxes next to eachother should look like…


Input1 Input2 Output1 Output2 Output3 Output4 => headings to the 6 lists

Drybulb Wetbulb RH Moisture Dewpoint Enthalpy => This represents 2 entries in lists
14 13 52% 0.001 24 75

Drybulb Dewpoint RH Moisture Wetbulb Enthalpy
14 13 52% 0.001 24 75

man i hope this makes sense
  • 0

#6
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Man, I read this several times, but I can't get the hang of it... (btw we are doing Enthalpies right now in school :))
I think you can try to just stick the entries together, just insert a comma or space between them. Then when you need to parse it, use Split:

Dim a As Variant  'will become an array

a = Split(lstList.Text, ",")


a will become an array, storing the various parts between the commas,

e.g.: if lstList.Text contains "14,13,52%,0.001,24,75"
then a(0) will contain 14, a(1) 13 etc....

Ooh, I hope this makes sense too. :tazz:
  • 0

#7
scozzard

scozzard

    Member

  • Topic Starter
  • Member
  • PipPip
  • 26 posts
Yea sorry my explanation was pretty crap, just check out this...

Form2.lstInput1.AddItem cboInput1.Text
Form2.lstInput2.AddItem cboInput2.Text
Form2.lstAltitude.AddItem ""
Form2.lstOutput1.AddItem cboOutput1.Text
Form2.lstOutput2.AddItem cboOutput2.Text
Form2.lstOutput3.AddItem cboOutput3.Text
Form2.lstOutput4.AddItem cboOutput4.Text

Form2.lstInput1.AddItem Output1
Form2.lstInput2.AddItem Output2
Form2.lstAltitude.AddItem Val(txtAltitude)
Form2.lstOutput1.AddItem Output3 * 100
Form2.lstOutput2.AddItem Output4
Form2.lstOutput3.AddItem Output5
Form2.lstOutput4.AddItem Output6


By doing this im adding 2 entries into 7 lists, essentially 2 rows into all the lists
- cbotext and Output values

Im tryna make it so these entries are combined to make one two-row-long
entry. hmm maybe split can be used

So in effect one lstbox row will look like

---------------------------
Enthalpy
30
----------------------------


anyways - thanks for the reply!

ps - enthalpies, drybulb, wetbulb, moisture content, relative humidity etc etc.....suck
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP