-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