Detect A Certain String From A Text File?
Jul 7, 2009How do i detect a part of a string from a string in a text file? I'm using vb08[code]...
View 10 RepliesHow do i detect a part of a string from a string in a text file? I'm using vb08[code]...
View 10 RepliesGoing from VB6 to VB10 I find VB10 has much easier ways of doing things, like getting command line arguments, getting all subfolders, etc, the hardest part is knowing what commands to use. Is there a better way to detect if a string ends with certain text? I'm doing it like this....
[Code]...
Is there any way to determine if a text file is currently open in a text editor? Or better yet, is there a way to trigger an event when a text file is opened (from any program)?
View 3 RepliesOkay so I'm trying to hide my program (only one form) so I'll just make a button and put me.visible = false , but I'm just wondering how to make my program detect a keypress (^ key) and show itself? I tried creating a timer and chucking
[Code]...
I have a function read the text file line by line, i have to detect a specific word in the text file befere proceed to another action. But I can't use substring because i not sure exact location of the word.
View 1 RepliesI have a question about collision, yes my 2d tile rpg's map collision works just fine, but im having trouble with the collision with my npc's. At the start of the game it loads all the map data from a text file. well it also loads the location and other stuff about the npc's onto the map from a text file. how do i detect the collision of the npc's that were loaded from the text file, i could do collision with hardcoded npc's but i want to avoid hardcoding the game content into the game engine. RESTATING MY QUESTION: How do i detect the collision of NPC's that i load onto my 2d tile map from text file?
View 6 RepliesThese is the content of my txt file which is saved in D drive in my pc abc,1,2,3..I tried the flowing but it didn't work:[code]I am getting error on this line.. data = line.Split(","c)...it says this line isn't in use anymore or something and that I rather use LineInput but thats asks for filenumber and i don't know what that is. I am sorry but I am a complete beginner. what else can I try? [code]ok that error is gone now but now if I want to add these values to a list box..how can i do that?
View 1 Repliesi have a string with the value = "/var/mobile/Media/iTunes_Control/Music/" i need to read the next 13 letter after this string in a text file i am also using a loop to do this multiple times
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Header As String = "/var/mobile/Media/iTunes_Control/Music/"
[Code].....
I have a label that reads a random line from a text file and that string becomes the text for the label.
Now the problem; the label will only work if it is clicked because the event handler is click.What I need is this to work automatically at startup. In other words, it should change the label's text to the random string of the text file on startup of the application.
Here is my code.[code..]
How would I go about replacing a portion of text in a text file with a string?
View 1 RepliesI've got an application that passes commands to a terminal window and saves all the output to a text file Here is one of the commands my application passes to the terminal
MyProcess.StandardInput.WriteLine("host " + device)
The output of which is
"HostA has address Y.Y.Y.Y"
this along with a whole bunch of other text is saved to a text file...my question is how do I find the sting "HostA has address Y.Y.Y.Y" in that text file and then extract the IP address and assign it as a string variable?
I came to a company that already has a fully grown project... but coders that worked here before me didn't follow conventions and didn't use parametrized SQL queries... as a result there is over 1000 places in a very huge project that can possibly be vulnerable to SQL injection...
I need to find a solution that will automatically detect if there is an SQL injection in the code. So, for example there is a form which allows user to enter comments regarding a product, which will be sent to database on submit... how can we make sure that a user didn't enter a harmfull query instead of a normal text?
Is there any advanced code/regular expression/magic that can detect if this text contains a piece of SQL query instead of normal harmless text? I will accept any links, pieces of code in any language or even commercial software that will do that for me.
i am working on a project to extract all md5 hash from a text file;btw i don't mean the text file hash i talking abt the hash string inside the file?
View 3 RepliesHow do i detect a part of a string from a string? For example: i want to check if the part of the string "mummy" exists in a string:"Mummy loves Daddy and loves me too"
View 1 RepliesI just want to know.. if I can detect the language of the text in the textbox (is it English or Arabic ) for example.
View 1 Repliesso I have a file called config.cfg that looks like this [code]
View 4 Repliesso in a program I'm working on in VB.NET I'm trying to make it so I can take in a list of strings (each on a different line). For each line I want to take in the line, and break it up into three parts. The first part goes from the beginning of the string to the first colon in the string, the second part goes from the first colon to the at symbol, and the last part goes from the at symbol to the end of the string.
For example, I'd take in a line of the series of lines: hello:world@yay
I'd want to break it into three separate strings of "hello", "world", and "yay".
How would I do such a thing in VB.NET?
I need to get the last Character in a text string and to decide if it is an equals sign or not.
View 5 RepliesI would like to know how to detect a two digit number within a string.
For example: how can I pull the number 42 from that string?
Not a professional at vb.net but I want to know how to check if a url ends with a number
I know this part:
If WebBrowser1.Url.ToString.Endswith("detect number") Then 'my coding here End If The problem is that I don't know what to put in 'Endswith()'
What I'm trying to do is add a string in the middle of a text file, instead of just appending the end of the file.[code]...
View 5 RepliesI am trying to delete the last line of a text file, then append new text to the end - The problem I have is that the code I have is set up to search for an Index, not a String, or the EOF line - I tried to modify it to search for the end string in the file, but that didn't work, either - Here's what I have:
'Delete last line
Dim lines As New List(Of String)(IO.File.ReadAllLines(LocalAppData & "settings.txt"))
'Remove the line to delete, e.g.
[code].....
I know how can i read string from the text file?[code]....
View 2 RepliesWhat I basically have is a small game which I want to count wins/loss/ties. I have no problem with the game aspect but need to know how I can replace a string in a csv file. IE: If Jim wins the game, his 5 needs to be turned to a 6. After googling quite a while I came across the replace() function, but it doesn't actually rewrite it back to the text file
Contents of users.txt:
Jim,1.jpg,5,1,0
Will,2.jpg,6,7,0
Tom,3.jpg,5,5,0
Snippet of
[code]....
The issue I have, is if I try to use any sort of IO function after this (WriteAllLines, streamwriter, etc) - I get a process is being used and can't touch the file (because its being read).Must I somehow create a new file with a copy of everything including the replaced string?
I've got two text files. The first has got a list of certain keywords. Each one if these keywords are fed into a combobox. Now, when I choose one of the items from this combobox, I want to search the other textfile for the same keyword and read from that point to the next keyword. And then feed each line into a listbox. Perhaps I should use an INI-file for this purpose, doesn't really matter for me.
The textfiles have this structure;
Textfile1:
London
Oslo
New York
Hamburg
Amsterdam
The second textfile has this structure;
Textfile2:
'London'
Apples
Oranges
Pears
'Oslo'
Pasta
Salami
Monkeyballs
'New York'
Dada
Duda
Dadadish
Is this possible? The reason I want to do it this way is to create a fully dynamic system. One which relies fully on whatever information is stored in these textfiles. I'm gonna build pretty complex strings from these results later on. So far, I've got this to read the first file and add each line to the combobox:
Dim oReadMenuFunction as System.IO.StreamReader
oReadMenuFunction = IO.File.OpenText("textfile1.txt")
Do While oReadMenuFunction.Peek <> -1
Dim LineIn as String = oReadMenuFunction.ReadLine()
Combobox.Items.Add(LineIn)
Loop
i tried to read from the data.txt like this..
[Config]
// name
name = fitri
[code].....
I want to connect to a text file(*.txt) through VB 6.0 and my connection string is:
"PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATASOURCE=C:Test.txt;EXTENDED PROPERTIES='Text;HDR=Yes;FMT=Delimited';"
I have also tried,
"PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATASOURCE=C:;EXTENDED PROPERTIES='Text;HDR=Yes;FMT=Delimited';"
But I am getting an error for both:
Runtime error: -2147467259(80004005)
Could not find installable ISAM
I have Windows XP SP2 and MDAC 2.8 SP1 has been installed with that
i am trying to make text file that will include my sms text meassges
for that in need a code that will extract the the line that appears after the string "text:"
example
the text file that exported from my phone look like this :
time: 22:00
text: bla bla bla
time: 23:35
text: yada yada yada
what i need is a new file that will look like :
newtextfile.txt
bla bla bla
yada yada yada
I am trying to detect if a string's encoding if different than cp1251
- usually its koi8-r and if so convert it to cp1251
As I understood it can be done using encoder and unencode?
I tried searching on the subject, and find almost nothing. I am kinda lost.
Is there a way to detect a Chinese character in a string which is build like this:
dim test as string = "letters 中國的"
Now I want to substring only the Chinese characters. But my code is database driven, so I can't substring it, because the length is always different. So is there a way I can split the string, from the moment I detect a Chinese character?