Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 132,275 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,144 people online right now. Registration is fast and FREE... Join Now!




listBoxs

 
Reply to this topicStart new topic

listBoxs

tophermackay
post 23 Feb, 2008 - 09:18 PM
Post #1


New D.I.C Head

*
Joined: 23 Feb, 2008
Posts: 7

ok i have three list boxs 2 of which have information in them i want the user to choose one out of the first 2 list boxes and then display what they have chosen in the 3rd list box? thanks topher

This post has been edited by tophermackay: 23 Feb, 2008 - 09:45 PM
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 23 Feb, 2008 - 09:19 PM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,923



Thanked 118 times

Dream Kudos: 8475

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks smile.gif
User is offlineProfile CardPM

Go to the top of the page

tophermackay
post 23 Feb, 2008 - 09:39 PM
Post #3


New D.I.C Head

*
Joined: 23 Feb, 2008
Posts: 7

QUOTE(PsychoCoder @ 23 Feb, 2008 - 10:19 PM) *

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks smile.gif


ok well ill have to write some code, everything that i have read tells me to us a text box or a label not a list box.

This post has been edited by tophermackay: 23 Feb, 2008 - 09:41 PM
User is offlineProfile CardPM

Go to the top of the page

tophermackay
post 24 Feb, 2008 - 09:52 AM
Post #4


New D.I.C Head

*
Joined: 23 Feb, 2008
Posts: 7

QUOTE(tophermackay @ 23 Feb, 2008 - 10:39 PM) *

QUOTE(PsychoCoder @ 23 Feb, 2008 - 10:19 PM) *

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks smile.gif


ok well ill have to write some code, everything that i have read tells me to us a text box or a label not a list box.


ok so i thought this would work but it doesnt
CODE
  Private Sub BtnAddWrkshp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAddWrkshp.Click


        Lst3Costs.Show(Lst1ws.SelectedIndex)

    End Sub

can anyone help
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 24 Feb, 2008 - 11:11 AM
Post #5


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Moved to VB.NET.

What exactly are you trying to do with that snippet of code?
User is offlineProfile CardPM

Go to the top of the page

tophermackay
post 24 Feb, 2008 - 12:25 PM
Post #6


New D.I.C Head

*
Joined: 23 Feb, 2008
Posts: 7

QUOTE(jayman9 @ 24 Feb, 2008 - 12:11 PM) *

Moved to VB.NET.

What exactly are you trying to do with that snippet of code?

i know their ia a way to allow a user to select an item out of 2 preloded listBoxs and then display what they selected in a 3rd list box so i can then write arguments for what is choosen?
i thought this would work for lst1ws when selected with the mouse, and when the user clicks btnaddwrkshp it will show what user selected in lst1ws in lst2costs
User is offlineProfile CardPM

Go to the top of the page

tophermackay
post 24 Feb, 2008 - 12:47 PM
Post #7


New D.I.C Head

*
Joined: 23 Feb, 2008
Posts: 7

QUOTE(tophermackay @ 24 Feb, 2008 - 01:25 PM) *

QUOTE(jayman9 @ 24 Feb, 2008 - 12:11 PM) *

Moved to VB.NET.

What exactly are you trying to do with that snippet of code?

i know their ia a way to allow a user to select an item out of 2 preloded listBoxs and then display what they selected in a 3rd list box so i can then write arguments for what is choosen?
i thought this would work for lst1ws when selected with the mouse, and when the user clicks btnaddwrkshp it will show what user selected in lst1ws in lst2costs

i can make it show in a messagebox but i cant make it show the selection in the 3rd list box

CODE

    Private Sub BtnAddWrkshp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAddWrkshp.Click
        Dim count As Int16

        count = Lst1ws.Items.Count
        MessageBox.Show(Lst1ws.Items(Lst1ws.SelectedIndex))




    End Sub

User is offlineProfile CardPM

Go to the top of the page

Jayman
post 24 Feb, 2008 - 02:11 PM
Post #8


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


That is because you need to Add it the the ListBox. And you should be using the SelectedItem property, not the SelectedIndex to get the text from the first ListBox.

CODE

Lst3Costs.Items.Add(Lst1ws.SelectedItem)
User is offlineProfile CardPM

Go to the top of the page

tophermackay
post 24 Feb, 2008 - 02:19 PM
Post #9


New D.I.C Head

*
Joined: 23 Feb, 2008
Posts: 7

ok i have been reading an and think that im on the right track but am still missing something this is what i have
in the code i put notes for more help i am really new to vb everything that i know i have read so any help would be great thanks topher

CODE

Private Sub BtnAddWrkshp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAddWrkshp.Click
        Dim intnum As String
        If Lst1ws.SelectedIndex = -1 Then
            'no Workshop is Selected
            MessageBox.Show(" Select a WorkShop ", "No WorkShop", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
        ElseIf Lst2loc.SelectedIndex = -1 Then
            'no Location is selected
            MessageBox.Show(" select a Location ", "No Location ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
        Else
            'get the selected workshop and location
            Lst3Costs = (Lst1ws.SelectedItem & " " & Lst2loc.SelectedItem)
            'i thought that doing lst3costs = (Lst1ws.SelectedItem & " " & Lst2loc.SelectedItem) would put my information that was selected into the the lst3costs list box but it doesnt how else can i do that"

        End If

    End Sub

End Class
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 24 Feb, 2008 - 02:20 PM
Post #10


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Read my previous post, you need to use the Items.Add method to add to a ListBox.

CODE

Lst3Costs.Items.Add (Lst1ws.SelectedItem & " " & Lst2loc.SelectedItem)
User is offlineProfile CardPM

Go to the top of the page

tophermackay
post 24 Feb, 2008 - 02:27 PM
Post #11


New D.I.C Head

*
Joined: 23 Feb, 2008
Posts: 7

QUOTE(jayman9 @ 24 Feb, 2008 - 03:20 PM) *

Read my previous post, you need to use the Items.Add method to add to a ListBox.

CODE

Lst3Costs.Items.Add (Lst1ws.SelectedItem & " " & Lst2loc.SelectedItem)



thanks i had the =
CODE

  Lst3Costs.Items.Add = (Lst1ws.SelectedItem & " " & Lst2loc.SelectedItem)

which was why it was wrong after i did what you said thanks for the help

This post has been edited by tophermackay: 24 Feb, 2008 - 02:31 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 12:29AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month