ListBox In VB 2005 Expression Edition

Item Value is not getting stored in Database

Page 1 of 1

2 Replies - 2132 Views - Last Post: 08 November 2007 - 04:53 AM Rate Topic: -----

#1 rajathtc  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 8
  • Joined: 06-November 07

ListBox In VB 2005 Expression Edition

Post icon  Posted 08 November 2007 - 12:26 AM

I am working in VB 2005 Expression Edition

i have list box which is populated from the database and i want to store the selected Item in the list box to another table in the data base please help, my code is bellow


		For intCounter = 0 To ListBox1.Items.Count - 1
			If ListBox1.GetSelected(intCounter) Then

				strArrSelectedEmployees(intSelectedCounter) = ListBox1.GetItemText(ListBox1.Items(intCounter).ToString)
				temp = ListBox1.Items(intCounter).ToString
				RichTextBox1.Text &= System.Environment.NewLine & temp
				intSelectedCounter = intSelectedCounter + 1
			End If



i'm trying to get the item into ricch tex box the value which is stored on button click is System.Data.DataRowView

Attached File  ex1.bmp (960.05K)
Number of downloads: 80
i have attached a screen shot in that it is showing what i'm getting when i click on button

please help

Is This A Good Question/Topic? 0
  • +

Replies To: ListBox In VB 2005 Expression Edition

#2 aceofspades686  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 6
  • View blog
  • Posts: 334
  • Joined: 08-October 07

Re: ListBox In VB 2005 Expression Edition

Posted 08 November 2007 - 01:57 AM

Its this line right here I believe:
temp = ListBox1.Items(intCounter).ToString


Try using temp = Listbox1.GetItemText(Listbox1.Items(intCounter))

I'll admit this is more a shot in the dark than anything, but it seems like its returning the item type as opposed to the item text. Hopefully someone else can shed some light on why, but this may help you get rid of your bug. Also, you may want to have the System.Environment.NewLine after you add the current line to the textbox, not before it.
Was This Post Helpful? 0
  • +
  • -

#3 rajathtc  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 8
  • Joined: 06-November 07

Re: ListBox In VB 2005 Expression Edition

Posted 08 November 2007 - 04:53 AM

Sir Thank you Very much it helped a lot to me
:bananaman:

:^:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1