-1
我完全是VB.net的新手,只有幾個星期才學習我正在做一個項目,我需要製作一個使用記事本作爲數據的EPOS系統基礎。我可以使按鈕的值出現在列表框中,但是我有許多按鈕都有不同的值,但每次按下不同的按鈕時,只有文本框中的第一個值出現。 E.G當按下顯示「喜力肯€5.00」的Guiness按鈕時,當Heineken按鈕按下「Heineken€5.00」時顯示從列表框中的記事本中顯示特定行VB.Net
任何幫助非常感謝!
Imports System.IO
Public Class Form1
Private Sub btnHeineken_Click(sender As Object, e As EventArgs) Handles btnHeineken.Click
Dim sr As IO.StreamReader = IO.File.OpenText("DATABASE.txt")
'File DATABASE.TXT is the the debug folder
Dim name As String
Dim stock, price As Double
name = sr.ReadLine
stock = CDbl(sr.ReadLine)
price = CDbl(sr.ReadLine)
lstBox.Items.Add(name & "" & FormatCurrency(price))
name = sr.ReadLine
End Sub
Private Sub BtnGuiness_Click(sender As Object, e As EventArgs) Handles BtnGuiness.Click
Dim sr As IO.StreamReader = IO.File.OpenText("DATABASE.txt")
'File DATABASE.TXT is the the debug folder
Dim name As String
Dim stock, price As Double
name = sr.ReadLine
stock = CDbl(sr.ReadLine)
price = CDbl(sr.ReadLine)
lstBox.Items.Add(name & "" & FormatCurrency(price))
name = sr.ReadLine
End Sub
DATBASE.txt
喜力, 5.00, 20, 吉尼斯, 4.50, 50, Bulmers, 5.00, 25,
[VB中的記事本數據庫]的可能重複(http://stackoverflow.com/questions/28670892/notepad-database-in-vb) – Heinzi 2015-02-23 15:41:11