Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 1675
Number of posts: 4764

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Need help with Visual Basic - limited programming knowledge Posted by Alexs777 on 25 May 2009 at 2:23 AM
For my computing project I have to make a stock control system. Basically, stored in a .dat file are the stock descriptions and I have programmed it to be displayed in a list box with this code:

Private Sub btnDisplayProducts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayProducts.Click
Dim Index As Integer
Dim OneProduct As ProductType 'one record
lstDisplayFile.Items.Clear()
FileOpen(1, FileName, OpenMode.Random, , , Len(OneProduct))
For Index = 1 To NumberOfRecords 'loop through all records in file
FileGet(1, OneProduct, Index) 'read one record. 3rd parameter not needed use the declared format to display one product in the list box
lstDisplayFile.Items.Add(String.Format(MyFormat, OneProduct.ProductId, OneProduct.Description, Format(OneProduct.Price, "currency"), OneProduct.QuantityInStock, OneProduct.Reorderlevel))
Next Index
FileClose(1)
End Sub

Private Sub DisplayOneProduct(ByVal Product As ProductType)
lblProdId.Text = Product.ProductId
lblDescription.Text = Product.Description
lblPrice.Text = Product.Price
lblQuantity.Text = Product.QuantityInStock
lblRecLevel.Text = Product.Reorderlevel
End Sub


Now - I want to be able to delete items from this list box by clicking on them and pressing my delete button. However, I have absolutely no idea how to do this. Any help would be greatly appreciated.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.