Searching A File And Displaying Results?

Nov 29, 2010

I have to write a program that allows a user to input DVD info such as DVD Name, Year produced, Running Time, and Rating. The user then clicks a menu item "New" to save that info to a file. Then the next time the user inputs new DVD info it has to append the new data to the same file. (I got this far and everything is working writing and appending data)Next the year has to be able to search by DVD Video name and it has to print the info in the text boxes on the form, if not found then a messagebox should say not found. When I use the sub procedure that I have created to search the record it always comes back as record not found although the record in in the file.

Option Strict On
Imports System.IO
Public Class Form1
'Class level variables

[code]....

View 1 Replies


ADVERTISEMENT

Searching A Text File And Returning Results?

Nov 25, 2011

I have been taking a class in Visual Basic and am currently working on my final project which I am having some trouble with. I am using Visual Basic 2010 express The project is to create an application that will store data in a text file, specifically, Last Name, First Name, Customer Number, Address, City, State, ZIP Code, Telephone Number, Account Balance, and Date of Last Payment. I have gotten everything done except the ability to search the file by Last Name or Customer Number. I have no idea how to go about this? I was thinking of ways to use indexof or Readline to be able to search the data, but I'm not familiar enough with the code to come up with a good solution. Below is a picture of how my form looks..As you can see, I'm currently using 2 separate forms to get the data from the user. Here is the code for Form1 which is the "Customer Accounts" form in the picture.

Imports System.IO
Public Class Form1
Public customerFile As StreamWriter ' Object variable
Public customerFile1 As StreamReader ' Object variable
Public strFile As String

[Code]...

There isn't enough room to post the code for my secondary form, but you get the idea. I would like to be able to enter a search term in the textbox on the bottom right of the form, and either search the data as its displayed in the listbox, or search the actual file? I was thinking that the results would be displayed in a messagebox?

View 3 Replies

Searching And Displaying Data From A Sequential Access File?

May 27, 2009

Im working on a program that will display a price when an item number is entered in the search box. I have the information in a text file for the program to find it but am unable. I have successfully made it so the items show up in a list box and will show the price when clicked on, but cant get the other one to work.

Here is my code for searching from a search box:

Option Explicit On
Option Strict On
Public Class TryonServices

[code]....

View 5 Replies

Searching Results In A Database

Apr 16, 2009

[Code]...

I need to happen is for whatever is typed in the txtStockBookID text box to be searched in the 'BookID' field in the database (dbStratagem) and for all relevant records to be produced in the datagrid (grdStockResult). The code used above has so far safely connected and displayed the entire table (dbStock) in the datagrid but I am not able to restrict the results to only criteria searched.

View 2 Replies

Searching A Database And Returning Results In A VB Form

Mar 30, 2009

I have a problem which I have tried to solve in several ways, and by searching the Internet for various terms, searching through books and Visual Basic instructional videos, but none have yielded the correct results. My goal is as follows:

1. Create a Database listing job names, job numbers, and a link to the file about the job.

2. Create a form with 2 text boxes, a search button, a box to display results, and a preview panel.

The two above steps have been completed. The following is where I get stuck

3. I want to search for either the job name, and/or the job number, have VB search through the database and return the results in the results box.

4. On clicking on one of the results in the result box, the preview panel will show a preview of the file.

Notes:
i) The files being linked top are Microsoft Excel files.

ii) The box I have used for the results currently is a listbox, though I've no idea if this is the correct choice for what I want to do.

iii) The database I created is an *.xml database created in Visual Basic. I am a fair beginner to VB, learning as I go, but I'm stumped as to how to achieve this so any pointers on how to achieve points 3 or 4

View 2 Replies

Searching And Displaying Result

Apr 13, 2011

I hav copied my whole cde in form 1 to give a better insight of my question.what I want is to search for a string example title of a song then display my result to a richtextbox but the result should include the title the location and number.[code]

View 2 Replies

Searching And Displaying Specific Records In A DataGrid

Apr 6, 2009

I've tried a few different methods I could find in order to connect my VB .NET program to a book store's database. While I've been able to connect to it and display the contents of its tables in a DataGrid, I need to be able to search the tables and display specific records, depending on the contents of appropriate the adjacent text boxes.[code]This is a code I've used for a very similar process, just really aims to search a different field in the table. If this is easier to adapt into a code that allows searching and producing specific records in a database, please use this one.

View 2 Replies

Displaying SQL Results With An Condition DGV?

Jan 30, 2010

My problem consist in show values into a cell of a DGV control, for example:MySQL Table:

ID - Name - Price - Type
1 Mouse Pad 2.85$ - a
2 Keyboard 10.50$ - a

[code].....

View 22 Replies

Displaying The Wrong Results?

Dec 12, 2009

I'm attempting the following code to calculate how many quarters, dimes, nickels and pennies a user should get as change, and display them in four labels, when buying an item from a machine. The user inserts the amount paid and the cost of the item in two textboxes.My code is as follows:

Code:
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

[code].....

View 6 Replies

Searching Database For Existing Item And Displaying An Error

Mar 11, 2010

In my program theres a form where the user enters the ID number and other details of a customer. i want the program to be able , If the ID number already exists when the user enters it and clicks on ok, to display an error message telling them that the ID already exists otherwise it adds the id and the details to a database. Im not sure how i would do that im thinking it would be an SQL statement? not sure.

View 7 Replies

Displaying Data Results Into DataView?

Jun 22, 2009

I can't understand how it happen. But this first code is working but the second code it did not work (but it is 100 % same code I just change it to the table name). I can't display the data result into DATAVIEW in post # 2, in post # 1 work perfect..

The database are:
Local: access 2003
Server: MySQL server

Post # 1 - Working
Private Sub TSRUpload()
If (Me.Ping.Send("PH180", 500).Status) = Net.NetworkInformation.IPStatus.Success Then
Dim ds As DataSet = New DataSet()
Dim tblLocal As New DataTable
Dim tblServer As New DataTable
[Code] .....

View 6 Replies

Displaying Multiple Tasks Results

May 13, 2010

I am building an application that will run through various tasks like database backup, zipping some other files and so on.I have the progress bar figured out for each individual task and I have all my tasks working.I am trying to build an interface to display to the user to show them the progress of the entire run.I was thinking like a list box or other object where I could put a green checkbox image or red x image as each tasks runs and is a success or failure.

View 1 Replies

Displaying Search Results In A New Form?

Jun 6, 2011

i'm working with a sql (2005) database and using visual studio 2010. I've created a system where one of the forms is a find/search form. A user can enter in for example, a customerID and once they click on "find/search" the customerID will be searched in the database and if found, all relevant information about the customer will be retrieved and displayed in another form (find/search results page). I realise that this can be done using an SQL statement like follows

searchStr = "SELECT * FROM Customer WHERE CustomerID LIKE CIDTextBox.Text%"

What i'm unsure about is how to execute this SQL statement once the "find/search" button has been clicked and how to display the founded results in another form.

View 7 Replies

Displaying Sql Query Results In Textboxes?

Apr 9, 2012

So I have coded connection to database and query but when I push button nothing happens. So my question is how can I fix that Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code]...

View 7 Replies

Displaying Results From A Temperature Conversion Program?

Oct 13, 2010

I am having trouble displaying my results from a temperature conversion program. I am sure it is something simple that I have overlooked. Here is the code.

[Code]...

View 3 Replies

Loading Results Into An Array To Be Used For Displaying Just Partial

Jul 14, 2009

The assignment called for a VB.Net (not web based) program that would accept user input for the loan amount, interest rate, and term of loan, and display the monthly payment of the loan then list the loan balance and interest paid over the term of the loan. the list will be longer than the screen so use loops to display a partial list, hesitate, and then display more of the list. So, I did exactly that and the program works fine. However, after submitting this program for grading, The instructor for the class tells me, "One thing you should work on is not using a timer to pause.

You should not use a scroll bar either." He says I should work on loading the results into an array or use a loop with a counter that can be used to display a given number of results with a more results button for displaying more (but without a scroll bar?). Like I said, this program works fine and I am not asking anyone for any specific code (some sort of example would be great but not necessary) What I am asking for is an explanation of how I would go about loading results into an array to be used for displaying just partial results at a time in some way other than I used here: [Code]

View 6 Replies

VS 2008 Listbox Displaying Sql Results In A Loop?

Aug 27, 2009

I have a listbox displaying sql results in a loop. Let's say I want to select one of those results and click a delete button. I have the button and box setup displaying the results just fine, I just do not have the functionality. How would I do that?

View 18 Replies

[2008] Query Database Using SQL And Displaying Results In Datagridview?

Sep 25, 2009

I had done this by using the query builder (in VS Studio) but soon found out thay I gain no points by doing it this way as I am not using any code. I have tried to adapt the code I had to insert data into my database, just changing the SQL sintaxa and some other bits, but it is not working yet. Well, it gives results, but I think it is still geting the results from the query I had built using the query builder. Here is the code I've got so far:

Public Class Form2
Private Sub btn_search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_search.Click
Dim str_search As String = txt_search.Text
Dim str_dob As String = txt_dob.Text

[code]....

View 5 Replies

How To Prevent .net Combobox From Displaying Multiple Results From A Single Data

Dec 9, 2010

I am currently having a headache on how to solve this problem that i am facing.here is the situation:I have a combobox and a list box on the main form. The combobox will get the data from the ms access database.In the database, i have the details of a person's IC, Name and DOB say for eg on one entry I have D215311523C,SHAWN,13/04/1987

So now, my combobox on form load will show the list of dates in the database to allow the user to search base on the date itself by clicking on the selected date. So when the user clicks on the particular date say 13/04/1987, people in the database whose birthday is 13/04/1987 will be shown on the listbox.Meaning to say if i have 3 entries whose dates are the same 13/04/1987, 3 entries will appear. If there is only two entry, then two results will be shown.

[Code]...

View 1 Replies

VS 2008 - Displaying / Printing Program Numerical Analysis Results?

Oct 23, 2009

I am writing a VB.NET Windows Application which takes numeric user-input and performs a complicated calculation, yielding many numeric output variables. Previously, I wrote a similar program in VB6, which output the results to a rich text box using fixed-width font in order to organize data in columns and used asterisks to delineate table areas and section borders. I then used the printer object for printing the output. This method was very archaic and difficult to modify when changes were necessary.

View 5 Replies

Forms :: Selecting Field And Then Displaying Results From The Comma Delimited Text?

Oct 11, 2011

655211, Male, David Graham, 1992, 20, 0411221122I have got the code which displays all the info, however i need to modify it to display only male or females

Dim fileReader As String
fileReader = My.Computer.FileSystem.ReadAllText("C:data.txt")
Label1.Text = (fileReader)

[code].....

View 1 Replies

VS 2008 Arrays Displaying States/searching Arrays?

Oct 30, 2010

the statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "

Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"

[code]....

View 1 Replies

Querying A Single Column And Displaying All Results In A Single Textbox?

Sep 5, 2010

I am trying to make a list, separated by a comma, of entries from a single column in a SQL database. I have been spending the last several days searching for a way to do this, but every thing I found either didn't work, or wasn't exactly what I was looking for.

The query will pull all the email address that are not null. What I need to know is how to take the result of that query and make it look like this:

email0@address.com, email1@address.com, email2@address.com, etc, etc, ...

I feel like I should know this, but for the life of me, I can't remember nor can I find it in any of the textbooks I have.

I am using Visual Basic 2010 and SQL Server 2005. I also have access to Visual Basic 2005 if needed.

View 2 Replies

VB: Searching For Text Within All PDF Files And Returning Results Of PDF Files Where Text Are Found On

Jun 20, 2011

On a image file (PDF), the OCR has recognised the picture and text. However on Visual Basics, how do you search for a text on this image file? The primary goal is to allow a text search (i.e POxxxxx) on all the image files (PDFs). The returns of the search will be the assciated image files where the text (i.e POxxxxx) is found on.

View 1 Replies

Opening An Excel 2003 File Then Searching That Open File For Data

May 22, 2012

I need to open an excel file from vb.net and then search it for specific data. I then need to take those data and insert them into text boxes on a form that i have created. This is all controlled by a button click. I already have some code that will open a file dialog box and let me navigate to the correct file, but I am having trouble with the search portion. I have tried the Find function but I am not sure of the proper syntax. I am using Visual Studio 2008 and Excel 2003.

[Code]...

View 7 Replies

Text File Searching And File Path Retrieval

May 1, 2011

Im trying to get a list of all the text files present (there file paths) in a certain folder (lets say C:\Users\podypodpod\Desktop\textfiles) and then add them to the list box (lb_Entrys)

ive manage to find this code to get all text files from the desktop , but i cant manage to edit it so i can give an actual filepath for it to search

CODE:

View 2 Replies

Searching One XML File For A Set Of Nodes And Inserting Them Into Another XML File?

Aug 21, 2011

I'm trying to do some simple XML manipulation by searching one XML file for a set of nodes and inserting them into another XML file at a specific location.I'm able to succesfully create a node list from one of the files using the following xpath statement [code].....

I'm struggling to see how I can easily select any node I want within the first XML file but the second file refuses to play ball! I've attached the second XML file should anyone wish to check that I've interpreted the structure correctly.

View 3 Replies

Searching A File Over A Network?

Feb 25, 2010

i would want to make an application that searches a file in a network.

View 1 Replies

Searching And Reading .txt File?

Jul 30, 2011

[code].....

View 9 Replies

Searching File For Text?

May 28, 2011

I'm trying to make a script that searches for multiple .TXT files in a directory, and then searches the text of each file for a matching string(ie. "turtles"). It will search each file for the word "turtles". I've been on google trying to figure this out for a while, I'm guessing StreamReader is the way to go?

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim l_Dir As IO.DirectoryInfo
l_Dir = New IO.DirectoryInfo(MyPath)

[code]....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved