![]() Also you can modified this system as per your requriments and develop a perfect advance level project. This is simple and basic level small project for learning purpose. If you want more latest VB projects here. I suggest that you think really hard about step 2 (How do I find data in a text file? How would I do it if I had the file printed out in front of me and were searching for the data personally?), come up with an algorithm and then return here and ask a new question if you need help translating it to code. Notepad In VB is a open source you can Download zip and edit as per you need. That won't work, and that's the reason why your code doesn't work. Translate the result of step 2 (the "algorithm") in code. ![]() You have a text file with a list of entries, how do you get the one you want? Next, think about how your program can do that. It looks like you already did that: You want to display "Guiness €4.50" when the "Guiness" button is clicked. So the next step is to take a more structured approach:ĭecide what your button click should do. It looks like you already discovered that. Unfortunately, putting arbitrary code in your methods won't make them do what you want. The ReadAllText method of the My.Computer.FileSystem object allows you to read from a text file. It would be much easier and more productive to add a TextBox control to your form (or a second form), and display the text there. If you want your methods to do different things, you need to put different code in them. Functions (Visual Basic for Applications) Support and feedback Have questions or feedback about Office VBA or this documentation Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback. Notepad is simply a TextBox control with a menu bar. Thus, they do exactly the same thing: They show the contents of the first entry in your text file. Private Sub BtnGuiness_Click(sender As Object, e As EventArgs) Handles BtnGuiness.Clickīoth your methods have exactly the same code. 'File DATABASE.TXT is the the debug folder Public Class Form1 Private Sub btnHeineken_Click(sender As Object, e As EventArgs) Handles btnHeineken.Clickĭim sr As IO.StreamReader = IO.File.OpenText("DATABASE.txt") When Guiness button pressed "Heineken €5.00" is displayed When Heineken button pressed "Heineken €5.00" is displayed I am able to make the values of the buttons appear in the list box, however I have numerous buttons all with different values but only the first value in the text box is appearing each time a different button is pressed. I am doing a project where i need to make an EPOS systems using notepad as a data base. I am completely new to VB.net and have only been learning in for a few weeks
0 Comments
Leave a Reply. |