7 Replies - 10983 Views - Last Post: 26 January 2012 - 02:04 PM Rate Topic: -----

#1 harismania  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-August 10

import all data from listbox to textbox

Posted 07 August 2010 - 07:29 PM

i would like to import all data from listbox to a textbox as it looks like in listbox. (vb6)
Cheers
Is This A Good Question/Topic? 0
  • +

Replies To: import all data from listbox to textbox

#2 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 817
  • Joined: 16-September 09

Re: import all data from listbox to textbox

Posted 07 August 2010 - 08:41 PM

View Postharismania, on 07 August 2010 - 06:29 PM, said:

i would like to import all data from listbox to a textbox as it looks like in listbox. (vb6)
Cheers

Do you have any code yet?
Was This Post Helpful? 0
  • +
  • -

#3 Kinwang2009  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 76
  • Joined: 07-February 10

Re: import all data from listbox to textbox

Posted 10 August 2010 - 01:24 AM

I hope below code will give you some clue.
Private Sub Command1_Click()
Dim i As Integer
    For i = 0 To List1.ListCount
    If Text1.Text = "" Then
    Text1.Text = List1.List(i)
    Else
    Text1.Text = Text1.Text & vbNewLine & List1.List(i)
    End If
    Next i
End Sub

Was This Post Helpful? 0
  • +
  • -

#4 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: import all data from listbox to textbox

Posted 10 August 2010 - 01:43 AM

perhaps a better way :)
Private Sub Command1_Click()
Dim i As Integer
Text1.Text =""
    For i = 0 To List1.ListCount-1
         Text1.Text = Text1.Text & List1.List(i)& vbNewLine
    Next i
End Sub



oh yea and i am pretty sure it must be to ListCount-1

This post has been edited by NoBrain: 10 August 2010 - 01:44 AM

Was This Post Helpful? 1
  • +
  • -

#5 Kinwang2009  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 76
  • Joined: 07-February 10

Re: import all data from listbox to textbox

Posted 10 August 2010 - 08:22 PM

Oh yea sure it should be ListCount-1. Thankx for correction
Was This Post Helpful? 0
  • +
  • -

#6 harismania  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-August 10

Re: import all data from listbox to textbox

Posted 05 September 2010 - 12:56 AM

View PostNoBrain, on 10 August 2010 - 12:43 AM, said:

perhaps a better way :)
Private Sub Command1_Click()
Dim i As Integer
Text1.Text =""
    For i = 0 To List1.ListCount-1
         Text1.Text = Text1.Text & List1.List(i)& vbNewLine
    Next i
End Sub



oh yea and i am pretty sure it must be to ListCount-1



Thanks 'NoBrain' that worked and problem solved
Cheers
Was This Post Helpful? 0
  • +
  • -

#7 huejii  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-January 12

Re: import all data from listbox to textbox

Posted 25 January 2012 - 06:32 PM

Sir how about vice versa....


all the text on the textbox will transfer again to listbox...

how do i code that????


thanks in advance...
Was This Post Helpful? 0
  • +
  • -

#8 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: import all data from listbox to textbox

Posted 26 January 2012 - 02:04 PM

post the code that you have tried and we will try to help you :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1