6 Replies - 42466 Views - Last Post: 01 May 2009 - 08:58 PM Rate Topic: -----

#1 Omerta   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-May 09

How to display combobox items in message box

Posted 01 May 2009 - 06:44 PM

I can't seem to figure this out...

In Display Categories (items from combobox) menu item click event procedure, display the categories (items from combobox) (each on a separate line) in a MessageBox.

Dim myMessage As String = ""

For


MsgBox(combobox.Text)
myMessage = myMessage + combobox.Text

Next
MsgBox(myMessage)



Any idea? I'd greatly appreciate any help

Is This A Good Question/Topic? 0
  • +

Replies To: How to display combobox items in message box

#2 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to display combobox items in message box

Posted 01 May 2009 - 07:02 PM

I have no idea what you just said, or what kind of help you're looking for. Can you provide a better explanation :)
Was This Post Helpful? 0
  • +
  • -

#3 Omerta   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-May 09

Re: How to display combobox items in message box

Posted 01 May 2009 - 07:08 PM

View PostPsychoCoder, on 1 May, 2009 - 06:02 PM, said:

I have no idea what you just said, or what kind of help you're looking for. Can you provide a better explanation :)


I want to take the contents of a combobox and display them in a messagebox
Was This Post Helpful? 0
  • +
  • -

#4 MrWobbles   User is offline

  • D.I.C Regular
  • member icon

Reputation: 31
  • View blog
  • Posts: 328
  • Joined: 11-April 08

Re: How to display combobox items in message box

Posted 01 May 2009 - 07:32 PM

Dim comboStr As String

For Each item In comboBox.Items
	comboStr &= item & vbCr
Next

MsgBox(comboStr)


Was This Post Helpful? 0
  • +
  • -

#5 Dazastah   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 15-April 09

Re: How to display combobox items in message box

Posted 01 May 2009 - 08:50 PM

Think like a listbox. This is only a single one. Not sure bout double
But maybe if you Cntrl+Select it will pop 2 up.
	Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
		MsgBox(ComboBox1.SelectedItem, MsgBoxStyle.Information, "Info")
	End Sub 

You can change that stuff to whatever.
But thats a SIMPLE Way to do it.
Was This Post Helpful? 0
  • +
  • -

#6 Omerta   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-May 09

Re: How to display combobox items in message box

Posted 01 May 2009 - 08:54 PM

Thanks for the help. I actually have a button to initiate the message box. But option strict is on so I can't use the & operand.

So I had to use this:
Private Sub DisplayCategoriesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayCategoriesToolStripMenuItem.Click

		Dim comboStr As String

		For Each item In MovieComboBox.Items
			comboStr &= CStr(item) & vbCr
		Next

		MsgBox(comboStr)
	End Sub


This post has been edited by Omerta: 01 May 2009 - 08:56 PM

Was This Post Helpful? 0
  • +
  • -

#7 Dazastah   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 32
  • Joined: 15-April 09

Re: How to display combobox items in message box

Posted 01 May 2009 - 08:58 PM

Try this for extra text
	Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
		MsgBox("Text" & ComboBox1.SelectedItem & "Text", MsgBoxStyle.Information, "Info")
	End Sub

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1