User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,234 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,754 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 825 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 2
Reputation: jason7361 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jason7361 jason7361 is offline Offline
Newbie Poster

ListBox project help :confused:

  #1  
Nov 12th, 2007
I am doing a ListBox project
here is the example:
http://i213.photobucket.com/albums/cc8/n9370/a4htm7.jpg

I almost down this project. but i still have somewhere need your help.
When i double click an item on toplist, i will move the item to the bottom list
For example, when i double click Acer, it will be to the bottom list.
which do the same thing when i click the button "move to bottom list"
i know how to write the code for that button,
here is my code for that
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim i As Integer
        For i = ListBox1.Items.Count - 1 To 0 Step -1
            If ListBox1.GetSelected(i) = True Then  
                ListBox2.Items.Add(ListBox1.Items(i).ToString)  
                ListBox1.Items.RemoveAt(i)    
            End If
        Next

    End Sub
but i don't know how to write for the selected item on double clicking. how do i write this?

Another problem i have is that
my testbox should be enabled only when any text present in the text box
how do i fix my code to do it? thank you.

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If TextBox1.Text = "" Then
            Button3.Enabled = False
        End If

    End Sub
Last edited by jason7361 : Nov 12th, 2007 at 4:25 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2002
Location: West Virginia
Posts: 405
Reputation: waynespangler is on a distinguished road 
Rep Power: 6
Solved Threads: 42
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: ListBox project help :confused:

  #2  
Nov 12th, 2007
The same as the button.
   Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
        Dim i As Integer
        For i = ListBox1.Items.Count - 1 To 0 Step -1
            If ListBox1.GetSelected(i) = True Then
                ListBox2.Items.Add(ListBox1.Items(i).ToString)
                ListBox1.Items.RemoveAt(i)
            End If
        Next
    End Sub
However it does not act as you would think. By selecting more than one object and double click, only the one doubleclicked on will be transfered. If you hold down the ctrl and doubleclick, all will be transfered but the one doubleclicked on. If you select several with the shift and holding down the shift then all selected will be transfered. If you make several random selections with the ctrl key and then hold down the shift and doubleclick then everything between the first selected and last selected will be transfered.
Last edited by waynespangler : Nov 12th, 2007 at 9:48 am.
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 5:09 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC