VS 2008 Question From A N00b Searching Arrays?
May 1, 2009
First (and probably not the last) post. My Problem I would like to search an array for a certain text (this has been read in from a text file (42 lines) and split to an array of 11 splits successfully). I see all the data in the array with a msgbox or written to a textbox. So I know the info is in the array.
When the text (will be from a textbox eventually, but for now is a fixed string) is found, (this is (0)), I would like to put the other parts (2), (3) etc.....into strings of their own. Obviously when not found, the search should move to the next line. My problem is, that I can't get a search loop working and moving to the next line until the text is found, it sticks on the first line, even if wrong (which it is!).
Of course when the text is found, I can write (2), (3) etc to variables and exit the search.
I know this has probably just a simple solution, but I've only been learning vb for a week now and my head is spinning at this problem, I just can't get the syntax and order right.
View 6 Replies
ADVERTISEMENT
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
Dec 17, 2009
I have 2 groups, the information i get comes out as follows.
Dim group1 As String = "3 4 7 8 10"
Dim group2 As String = "0 1 2 5 9"
The placements are predetermined, so when the first perso
[code].....
View 1 Replies
Mar 27, 2009
i have been making an application that uploads files to an FTP server, what i wanna know is if it runs it to a problem how can i make it bypass that for example.
View 4 Replies
Mar 4, 2010
i am working on a VB project for Chem and im making it for converting grams to moles, moles to molecules or any thing like that. and i have about 110 elements set up and working fine the way that im doing it but i have a feeling this is a horrible way and to abundant.
i have a textbox set up to if i type in the element He and hit enter it will find ChemElement(1)="He" and it calls "Sub DisplayElement(ByVal number As Decimal, ByRef label2 As Label)"
Which then displays the Chemical mass into a Label.
[Code]...
View 17 Replies
Jun 4, 2009
I am a complete n00b to VB. I was looking for a solution to get the coordinates for the users work area and the following on the net. However when i use it i get all values as 0
[Code]...
View 7 Replies
Dec 14, 2009
I have textbox that the user will be able to write to.Say it looks like this:Hello my name is lolCause i don't know this.Then i want to split it by lines, so for exampleline(0) = Hello my name is lol.line(1) = I waline(2) = Cause i don't know thisAnd user should be able to write as many lines he wants, so i think i have to use a For Each thingy.(??)And then with the click of a button, it should write those lines in a string like this:
View 3 Replies
May 9, 2010
In VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.
The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?
View 3 Replies
Dec 10, 2009
My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.
'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays
[CODE]...
View 5 Replies
Feb 2, 2010
I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element And that element is 0.I read on the internet somewhere that when doing this kind of thing it is a good idea to only pass the first element of the array into the function.I tried changing my function declaration to accepting single elements rather than single dimensional arrays, and now the arrays are the same length before and after the function call, but they don't seem to be changing at all, so i'm not sure that this is working
View 1 Replies
Feb 3, 2010
I`m developing an appication which works with a mssql server database.At this stage I don`t have a problem connectiong to a database, because it`s on my computer.But the release version will be installed on few computers, when after installation user will have to choose the correct database to use with the application. I know how to find a working instances of MS SQL server in LAN, but after choosing an instance how to choose the correct database?
1. How to show databases availabale in th instance?
2. How to separate database designed for my application from all other databases in chosen instance?
View 3 Replies
Jun 11, 2009
how to add and remove entries from a database and now I need to know how to search it. I'm going to be scanning a directory and subdirectories and adding all files found to the database. I need to check if the file has already been entered into the database before adding it.
I though it'd be simple and would just require looping though each entry and checking the item for each entry. I played around with a while loop a bit and ran into some problems. Like when the database is empty.
I don't want to half-ass some code that seems to work, since that'd probably be slow and inefficient.
Also what are the technical terms for a column and row in a database. I'd to use the proper terms in the future.
View 1 Replies
Apr 13, 2010
Now that we have that part out of the way lets start with the question.I am attempting to create a small application which will use data form CSV or TXT file and display it in a DataGridView.But what I am interested in is if I would be able to use SQL commands to search through the imported file. Commands like (SELECT, FROM, WITH etc.) and then poplute the DataGridView with the results.
View 9 Replies
Jan 20, 2011
I'm currently in the middle of attempting to create a query that will be used so that the application user will be able to search the a customers id number. I'm completely new to adding queries using the query builder so I've become slightly stuck on trying to get this to work currently. I have a database which is set up and in this case the table is called 'cid' which defines the customers id column in the database, this is a primary key and the column has a data type 'AutoNumber'. I've become stuck as I'm not sure what I would have to put into the filter to make this query work.
View 7 Replies
Apr 27, 2009
this is what I've got so far:
Dim find As String
Dim search
find = InputBox("Enter Search Text")
search = MyRichTextBoxEx1.Find(find)
[code].....
But how can i search for the next occurrence of the search?
View 2 Replies
Feb 17, 2010
I'm searching through an html page and I want to put all of the Regex matches into an array? How would I go about doing this? I see the Regex.Matches but I can't quite understand how to use it an MSDN sucks when it comes to explaining it.
View 4 Replies
Jun 27, 2009
I haven't programmed for some time, so I'm a little rusty Basically I'm storing HTML within a variable, and I need to count the amount of times a specific element appears e.g. <h3 class=r> for now.
I thought of using a for each loop, and passing the string above into the parentheses of the loop (using a variable ofc) however for many reason's, I don't think this has a chance of working (won't bother explaining why, as I assume you can guess). Then thought of using the .Contains method of the string class, but I simply can't think of how to use it with what I'm trying to do.
View 2 Replies
May 2, 2010
I'm trying to get a program running that loads a sequential file such as "records.txt" into a two dimmensional array and searches the "records.txt" for the data that the user enters into a text box. Not quite sure how to go about doing this.
View 1 Replies
May 21, 2012
I have a simple customer database as follows :
[Code]...
There are total 50 rows of customer record in my database.. I have just drag the customer database from my data source windows into my form to get all the required tools with datagrid window. I want to add the date search box on my form to search customer between the date specified in textbox. eg : From 14.05/2003(textbox1) to 25/05/2010(textbox2) After putting the date , as I click search button the customer database should be shown between selected date.
View 4 Replies
Sep 13, 2010
i have this code [code]i want it to return me only 1 value which is the exact text as textbox1.text.
View 1 Replies
May 15, 2010
i have this code
vb
For Each sWord As String In listbox1.Items
If textbox1.text.Contains(sWord) Then
but the problem is if the textbox1.text value is ( new text ) and the list box have like 3 items
new
new text
text
it will return me 3 values i want it to return me only 1 value which is the exact text as textbox1.text ( new text )
View 1 Replies
Sep 5, 2009
I'm using oledbdataadapter for query lets say i have a fields Firstname, Surname, Location, Gender
Firstname| Surname| Location| Gender
Angel David Alaska Female
David Leonard Alabama Male
Michael Reeves Indiana Male
i want to filter data so that if I put a keyword %david% and select combobox as "MALE" it will search david on the first three fields and return
David Leonard Alabama Male
View 19 Replies
Aug 25, 2011
Ok so I have this program that shows data in a treeview and that data is from a datatable.I'm basically looping through the datatable row by row and adding nodes.The data looks something like the following:
[code]...
I have a thread that is hitting the Database (where these records are stored) every 5 seconds to see if the list is smaller,bigger or changed.If so, I was just recalling the load_form sub but this was taking too long as the lists could potentially be very large. Also, there is a lot of logic that comes into play depending on what user is displaying the records in the treeview.I was wanting to know what would be the fastest way to compare the datatable that was previously used to initially create the nodes in the treeview to a tempdatatable that has the currently updated/added/removed rows and update the treeview accordingly?The only thing I could come up with was basically looping through the tempdatatable and comparing each row to the rows in the original datatable and plucking out the ones that had no match.Then recursively looping through the nodes in the treeview to find the spot that the new node should be added (based on that datarow's values).Or is there a better way to do this and I should scrap this?
View 1 Replies
Jul 8, 2010
I have a form that reads the data from the database table ( so you can see I have figured out how to attach to a databse table)On the form I can scroll through the data with use of the binding navigator that VB automaticly installed on the form, but I need to search the table for specific data in one field.I am guessing that one way is to use a query, but I can't figure out how to use one.I realize that this may be real simple, but because I am just learning VB, I don't know where to start.
View 4 Replies
May 20, 2009
I have a microsoft database file i'm currently working with in a project. I have already added the data source and all seems to be going well. Quick question though? What I'm looking to do was, have a button called find, when I click it I want it to bring up an input box and use the text the user types in to search through my binding source of names, if it's there I need to display its record to the textbox and if it's not there I need to print out a messagebox saying its not there. I've been told I should trim the usersResponse and look through the binding source table to see if it exists then go from there, but i'm not sure how to do that.
Here's what I have so far:
Dim Message As String = "Enter the name to find."
Const Title As String = "Database Project - Find"
Const UserEnteredNullData As String = "No input for find."
[CODE]...
My question is, how would I go about searching through my binding source to see if it exists and how would I display it to the name text box?
View 4 Replies
Jun 6, 2009
Here is my
vb.net
Module FileCheck
Public BW_AntiCorrupt As New Threading.Thread(AddressOf AntiCorrupt)
Dim THardDrive As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim HardDrive As String = THardDrive.Substring(0, THardDrive.IndexOf("") + 1) 'C:
Public ContinueSearch As Boolean = True
[Code] .....
I am having a problem. The IO.Directory.GetFiles code is resulting in error do to the fact that it is trying to access the Temp folder in the Windows folder on drive C:. Apparently that folder is restricted... When the code encounters that folder the code stops retrieving files. Is there a way around this? Is there somewhere i can give my program administrator access? If not then am i able to skip the files in that location?
View 7 Replies
Nov 30, 2009
I'm writing a small app that finds the directory of an active program and displays it in a message box. e.g. Microsoft Word is open and running... click a button and the app finds the Microsoft Word's directory. It has to be able to differentiate between the active program and inactive copy of the program.
View 1 Replies
Jan 17, 2010
how do you search a string for capital letters, is there a function I can use to return to me how many capital letters are in a string? I have tried searching this but as yet not stumbled across a function. Most functions I found converted lower case to upper case Etc. I thought InStr might be the one but still looking for information on that one. I did find something along the lines of .char.isupper but the textbox is .text A password 'rating' tool of sorts of which I use a counter so if I enter "STRing" in the textbox for example it will return a 3 add it to the counter and continue with the little algorithm which my rater uses to add up things such as numbers or special characters to get a final score and that indicates to the user how strong the password is.
View 2 Replies
Jun 25, 2011
i am currently working on a database project using Microsoft Access 2007 and VB Express 2008.my problem is, i want to create a searching function in one of my tables; table Coachee. I know that it is possible to search data using bindingsource.filter as i've already succeeded in doing that. The thing is, how do i actually prompt a messagebox saying that the record of the Coachee ID to be searched is not found? [code]
View 4 Replies
Oct 24, 2010
How would I use FileStream.Read() to search for a string inside a file and then return the string's offset? (basically like a Hex editor)
View 12 Replies