[Help]Textbox / Reading

Posts 16–28 of 28 · Page 2 of 2
How do these items look like?

Multiple columns?

The user defines that information?

I don't get you. You gotta be more EXACT!
Quote Originally Posted by Blubb1337 View Post
How do these items look like?

Multiple columns?

The user defines that information?

I don't get you. You gotta be more EXACT!
It's look like any list Box
_________
|_______ |
|_______ |
|_______ |
|_______ |

and
i wanna add <info1> and <info2> and much Info to the listBox
and I'm talking about Way Read the
Txt file organizer look like
[php]
[listbox1]
items1= mo3ad001
items2= Blubb1337
items3= anybody

[listbox2]
Age1= 19
age2= Unknown
age3= any Body Age
[/php]

and thank you Because you wanna Help me ^_^
Is the amount of items unknown? So you will actually use this for multiple listboxes or just multiple columns?

I suggest you go for multiple columns

|Name | Age | Gender|
''''''''''''''''''''''''''''''''''''''''''''''''''
|Blubb | 16 | M |
''''''''''''''''''''''''''''''''''''''''''''''''''
|Hassan | 3 | F |
''''''''''''''''''''''''''''''''''''''''''''''''''
|Jason | - | M |
''''''''''''''''''''''''''''''''''''''''''''''''''

If you want it like that, I'll write something up 4 you.
Quote Originally Posted by Blubb1337 View Post
Is the amount of items unknown? So you will actually use this for multiple listboxes or just multiple columns?

I suggest you go for multiple columns

|Name | Age | Gender|
''''''''''''''''''''''''''''''''''''''''''''''''''
|Blubb | 6 | L |
''''''''''''''''''''''''''''''''''''''''''''''''''
|Hassan | 19 | VMM (Very Much Male) |
''''''''''''''''''''''''''''''''''''''''''''''''''
|Jason | 0.4 | N/A |
''''''''''''''''''''''''''''''''''''''''''''''''''

If you want it like that, I'll write something up 4 you.
Fixed it for ya.
Quote Originally Posted by Hassan View Post


Fixed it for ya.
You're so friggen' hilarious Hassan *claps*

Quote Originally Posted by Blubb1337 View Post
[php]using streami as new io.streamwriter("C:\test.txt", false)
streami.write("Text")
end using[/php]

I recommend you using .ini...you can sure do this with a streamwriter/streamreader but meh....

you can better use:
Code:
using streami as new io.streamwriter(application.executablepath + "Infos.txt)
streami.write("Text")
end using
Quote Originally Posted by AeroMan View Post
you can better use:
Code:
using streami as new io.streamwriter(application.executablepath + "Infos.txt)
streami.write("Text")
end using
I see, you didn't care to read the topic.

1. Executeablepath gives the whole path of the executeable, so it will also be the name & extension.

2. You'd go for application.startuppath

3. "Infos.txt"

4. An error might occur, use path.combine to be sure not to have an wrong path error

streamwriter(path.combine(application.startuppath, "Infos.txt"))

Please read the thread before replying.
Okay, I think I've got what you wanted.
What I understand from your post is that you want a program that can read a textfile line by line.

So lets say this is test.txt:
Code:
this
is
test.txt
I'm guessing you can use this:
Code:
Dim filein As String
Dim StringToLookFor As String = "is" 'string to look for
Dim filename As String = "C:\test.txt" 'the file
Dim objReader As New System.IO.StreamReader(filename)
	filein = objReader.ReadToEnd 'reads the document to the end
	If filein.Contains(StringToLookFor) = True Then 
		MsgBox("String Found") 'if it finds the string it displays messagebox, can be changed with textbox1.text = , etc
	Else 
		MsgBox("String NOT Found")'if not found
		objReader.Close()
	End If
Hope this helps
Quote Originally Posted by Blubb1337 View Post
Is the amount of items unknown? So you will actually use this for multiple listboxes or just multiple columns?

I suggest you go for multiple columns

|Name | Age | Gender|
''''''''''''''''''''''''''''''''''''''''''''''''''
|Blubb | 16 | M |
''''''''''''''''''''''''''''''''''''''''''''''''''
|Hassan | 3 | F |
''''''''''''''''''''''''''''''''''''''''''''''''''
|Jason | - | M |
''''''''''''''''''''''''''''''''''''''''''''''''''

If you want it like that, I'll write something up 4 you.
why Not :-) that will be Nice But with explanation

Quote Originally Posted by skiiiz View Post
Okay, I think I've got what you wanted.
What I understand from your post is that you want a program that can read a textfile line by line.

So lets say this is test.txt:
Code:
this
is
test.txt
I'm guessing you can use this:
Code:
Dim filein As String
Dim StringToLookFor As String = "is" 'string to look for
Dim filename As String = "C:\test.txt" 'the file
Dim objReader As New System.IO.StreamReader(filename)
	filein = objReader.ReadToEnd 'reads the document to the end
	If filein.Contains(StringToLookFor) = True Then 
		MsgBox("String Found") 'if it finds the string it displays messagebox, can be changed with textbox1.text = , etc
	Else 
		MsgBox("String NOT Found")'if not found
		objReader.Close()
	End If
Hope this helps
That helped Right
but I'm not ask about Word I'm ask about Unknown word
I have already posted this.

You just have a if sentence in it.

By the way, if sentence already returns true/False.

So you basically did, IF true = True

+ Don't dim it, use "Using".
[php]dim path as string = io.path.combine(application.startuppath, "List.txt")[/php]

[php]if io.file.exists(path)
Using write as new io.streamwriter(path, true)
write.write(txtname.text & ";" & txtage.txt & ";" & txtgender.txt & vbnewline)
end using
end if[/php]

[php]listview1.items.clear

if io.file.exists(path)
using read as new io.streamreader(path)
while not read.endofstream
try
dim x() as string = read.readline.split(CChar(";"))
listview1.items.add(x(0))
listview1.items(listview1.items.count - 1).subitems.add(x(1))
listview1.items(listview1.items.count - 1).subitems.add(x(2))
catch ex as exception
end try
end while
end using
end if[/php]

I didn't test it, wrote it out of my mind, might contain errors =D
Quote Originally Posted by Blubb1337 View Post
[php]dim path as string = io.path.combine(application.startuppath, "List.txt")[/php]

[php]if io.file.exists(path)
Using write as new io.streamwriter(path, true)
write.write(txtname.text & ";" & txtage.txt & ";" & txtgender.txt & vbnewline)
end using
end if[/php]

[php]listview1.items.clear

if io.file.exists(path)
using read as new io.streamreader(path)
while not read.endofstream
try
dim x() as string = read.readline.split(CChar(";"))
listview1.items.add(x(0))
listview1.items(listview1.items.count - 1).subitems.add(x(1))
listview1.items(listview1.items.count - 1).subitems.add(x(2))
catch ex as exception
end try
end while
end using
end if[/php]

I didn't test it, wrote it out of my mind, might contain errors =D
That Easy To Understand But wait to Test it
[php]if io.file.exists(path)
Using write as new io.streamwriter(path, false)
for each item as listviewitem in listview1
write.write(item.text & ";" & item.subitems(1).text & ";" & item.subitems(2).text & vbnewline)
next
end using
end if [/php]

Also working ^^
Posts 16–28 of 28 · Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?