List box last element show in msgbox problem

  • (2 Pages)
  • +
  • 1
  • 2

24 Replies - 1275 Views - Last Post: 30 March 2013 - 11:39 AM Rate Topic: -----

#1 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

List box last element show in msgbox problem

Posted 30 March 2013 - 02:28 AM

Hello guys, I have a small problem. I have a 2 lists and want to grab last element and show in the msgbox.
For example, if 2 lists are for article and price, msgbox show last article and price in for example 10 add-es.
thanks :)
Is This A Good Question/Topic? 0
  • +

Replies To: List box last element show in msgbox problem

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3738
  • View blog
  • Posts: 13,067
  • Joined: 12-December 12

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 02:48 AM

Quote

in for example 10 add-es.

..what does this mean?
Was This Post Helpful? 0
  • +
  • -

#3 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 02:51 AM

Mine mistake, result must show in third list like text.

Quote

in for example 10 add-es.

means that i enter 10 different price and aritcles, not just one.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3738
  • View blog
  • Posts: 13,067
  • Joined: 12-December 12

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 02:56 AM

View Postmercy_angel, on 30 March 2013 - 09:51 AM, said:

Mine mistake, result must show in third list like text.

Your original post stated that you want to use a msgbox, now you are suggesting a (third) list, or do you mean a textbox? You are more likely to receive assistance if you explain your question more clearly.
Was This Post Helpful? 0
  • +
  • -

#5 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 02:59 AM

With msgbox is another example, mine mistake.
Do you want to help me or not. Please, if Not, don't post stupid answers. Thanks.
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3738
  • View blog
  • Posts: 13,067
  • Joined: 12-December 12

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:05 AM

View Postmercy_angel, on 30 March 2013 - 09:59 AM, said:

With msgbox is another example, mine mistake.
Do you want to help me or not. Please, if Not, don't post stupid answers. Thanks.

I would have helped you but no longer. Good luck anyway.
Was This Post Helpful? 0
  • +
  • -

#7 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:06 AM

I saw that you wanted ;)
Was This Post Helpful? 0
  • +
  • -

#8 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,796
  • Joined: 26-March 09

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:17 AM

mercy_angel, you need to chill your beans a little, cheesing off one of the experts in the subject isn't going to get your problem solved.

Your question and points are a little ambiguous to say the least and Andrew was trying hard to coerce out of you exactly what you want, as you change from post to post.

How about showing some code of what you've already tried (posted in [ code] tags) and try again to explain what you're trying to achieve.
Was This Post Helpful? 0
  • +
  • -

#9 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:31 AM

Sorry

 

Private Sub Command5_Click()
For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then List3.AddItem List1.List(i)
Next i
For i = 0 To List2.ListCount - 1
If List2.Selected(i) Then List3.AddItem List2.List(i)
Next i
End Sub






This is what i have trying but in list3 doesn't show nothing.
Was This Post Helpful? 0
  • +
  • -

#10 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,796
  • Joined: 26-March 09

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:43 AM

If you only need the last element in the list, you don't need to loop through the whole list to get it. Also, you're only looking at selected items.

You can use the following code to reference the last item only.

listview1.listitems.item(listview1.listitems.count))

Was This Post Helpful? 0
  • +
  • -

#11 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:47 AM

Run time error 424
Object required
Was This Post Helpful? 0
  • +
  • -

#12 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,796
  • Joined: 26-March 09

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:52 AM

Show the code on how you have tried to use it.

You will need to substitute your list control names with the ones that I wrote for you as well as completing it.

I didn't write it for you to paste in. That way, you need to think a little about what you are doing.

Copying and pasting code won't help you learn.
Was This Post Helpful? 0
  • +
  • -

#13 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 03:55 AM

listview1 is mine third list?
I am confused by yours writing, that's all
Was This Post Helpful? 0
  • +
  • -

#14 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,796
  • Joined: 26-March 09

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 04:00 AM

Why would listview1 be your third list? You have called your lists, list1, list2 and list3.

The code I posted shows you how to reference the last item in a list control.

Change listview1 to the list control you want to get the last item from.
Was This Post Helpful? 0
  • +
  • -

#15 mercy_angel  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 124
  • Joined: 28-February 13

Re: List box last element show in msgbox problem

Posted 30 March 2013 - 04:09 AM

i am all confused now.
List control that i want to use to get the last item is what?
Please give me a code, beacuse i'm all confused now.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2