2 Replies - 951 Views - Last Post: 29 November 2009 - 08:32 PM Rate Topic: -----

#1 jng2608  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-November 09

Display listbox's seleted record in several text boxes.

Posted 29 November 2009 - 05:35 PM

Hi there everyone!! I'm one step away from finish my project and i need your help :). My program add information from textboxes (firstname, lastname..) to list box and i have it display like this ( all information in one line separate by space):

Fname Lname phone email

My next step is copy back those information to textboxes ( in same order) for editing. Here is my code; and the error VB return is "Index was outside the bounds of the array."

Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
		Dim sIndex As String
		sIndex = lstTable.SelectedIndex
		Dim eArray() As String
		eArray = sIndex.Split(" ")
		txtFirstName.Text = eArray(0)
		txtLastnName.Text = eArray(1)
		txtEmail.Text = eArray(2)
		txtPhone.Text = eArray(3)
		txtMajor.Text = eArray(4)
		txtGpa.Text = eArray(5)

	End Sub



Thank you all for your help!!

Is This A Good Question/Topic? 0
  • +

Replies To: Display listbox's seleted record in several text boxes.

#2 some_kid  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 43
  • Joined: 26-May 09

Re: Display listbox's seleted record in several text boxes.

Posted 29 November 2009 - 06:22 PM

It looks like a simple mistake try changing sIndex = lstTable.SelectedIndex to sIndex = lstTable.SelectedItem .

This post has been edited by some_kid: 29 November 2009 - 06:23 PM

Was This Post Helpful? 0
  • +
  • -

#3 jng2608  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-November 09

Re: Display listbox's seleted record in several text boxes.

Posted 29 November 2009 - 08:32 PM

View Postsome_kid, on 29 Nov, 2009 - 05:22 PM, said:

It looks like a simple mistake try changing sIndex = lstTable.SelectedIndex to sIndex = lstTable.SelectedItem .


Thank you!! :) simple fix but you sure save my day.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1