5 Replies - 2414 Views - Last Post: 14 February 2007 - 07:24 AM Rate Topic: -----

#1 nkateko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-February 07

Rich text box

Posted 07 February 2007 - 06:42 AM

can anybody help me with this:

my programme reads a file into richtextbox.

I want code that searches for multiple paragraphs in the richtextbox and displays it in another textbox. would appreciate it much.
Is This A Good Question/Topic? 0
  • +

Replies To: Rich text box

#2 Louisda16th  Icon User is offline

  • dream.in.assembly.code
  • member icon

Reputation: 15
  • View blog
  • Posts: 1,967
  • Joined: 03-August 06

Re: Rich text box

Posted 08 February 2007 - 07:47 AM

To read a file:
RichTextBox1.Text = My.Computer.FileSystem.ReadAllText("<path>")



Post your code. It doesn't matter if its wrong. We'll help you out.
Was This Post Helpful? 0
  • +
  • -

#3 nkateko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-February 07

Re: Rich text box

Posted 09 February 2007 - 12:03 AM

View PostLouisda16th, on 8 Feb, 2007 - 07:47 AM, said:

To read a file:
RichTextBox1.Text = My.Computer.FileSystem.ReadAllText("<path>")



Post your code. It doesn't matter if its wrong. We'll help you out.




I am just a biginner wit VB.NET.
When I use that code on my Application it gives me an ERROR on "My.Computer" the compiler underlines the "My" Part. Do I need to use a specific header?

Here is the code that I used to search for something in the rtf, but this code only searches for 1 text and uses the position to find the text. I am lookin for a code that looks for the word for example "Computer" thats the starting text and "098" as the ending text and then displays everything thats in beween "text" to "098" inside a rtf.


Dim MyFileLine As String = Split(Tr.ReadToEnd(), vbCrLf)(7) 'Tr.Close
MsgBox(MyFileLine)
RichTextBox2.Text = MyFileLine


Thanks a lot
Was This Post Helpful? 0
  • +
  • -

#4 Louisda16th  Icon User is offline

  • dream.in.assembly.code
  • member icon

Reputation: 15
  • View blog
  • Posts: 1,967
  • Joined: 03-August 06

Re: Rich text box

Posted 09 February 2007 - 01:04 AM

Try this piece of code to do your checking:
		Dim checktext As String, length As Integer, Starting As Boolean, Ending As Boolean
		length = Len(RichTextBox1.Text)
		checktext = InStr(RichTextBox1.Text, "098", CompareMethod.Text)
		If checktext = (length - 2) Then Ending = True
		checktext = InStr(RichTextBox1.Text, "Computer", CompareMethod.Text)
		If checktext = 1 Then Starting = True
		If (Starting = True And Ending = True) Then 
				   'Put Whatever Code You Want
		end if



And to display what's in between use the Mid() function:
RichTextBox2.Text = Mid(<string expression>, <start position>, <length>)


The Mid() function allows you to extract a part of the string from a starting position you would want to specify. The first parameter specifies the string you want to extract from. The second parameter is the starting position. The third one is the number of characters you want to print from this position (this includes the character on your starting position).
Hope it helps :)
Was This Post Helpful? 0
  • +
  • -

#5 nkateko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-February 07

Re: Rich text box

Posted 13 February 2007 - 12:35 AM

Thank You so much the code worked beautifully.

Thanx a lot



















View PostLouisda16th, on 9 Feb, 2007 - 01:04 AM, said:

Try this piece of code to do your checking:
		Dim checktext As String, length As Integer, Starting As Boolean, Ending As Boolean
		length = Len(RichTextBox1.Text)
		checktext = InStr(RichTextBox1.Text, "098", CompareMethod.Text)
		If checktext = (length - 2) Then Ending = True
		checktext = InStr(RichTextBox1.Text, "Computer", CompareMethod.Text)
		If checktext = 1 Then Starting = True
		If (Starting = True And Ending = True) Then 
				   'Put Whatever Code You Want
		end if



And to display what's in between use the Mid() function:
RichTextBox2.Text = Mid(<string expression>, <start position>, <length>)


The Mid() function allows you to extract a part of the string from a starting position you would want to specify. The first parameter specifies the string you want to extract from. The second parameter is the starting position. The third one is the number of characters you want to print from this position (this includes the character on your starting position).
Hope it helps :)

Was This Post Helpful? 0
  • +
  • -

#6 nkateko  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-February 07

Re: Rich text box

Posted 14 February 2007 - 07:24 AM

i wrote a programme that uses a loop to read the number of occurances of the word "Terminal". The reason why I did the function is because I want the programm to extract the required data and wrie to file each time it finds the next occurance of "Terminal". But the programme somehow only extract data on the first Occurance of "Terminal".

Please help its urgent deadline is tomoro

Data to extract is the Italic words

Example

Terminal
Product: Frame Impress National
Circuit no: 51057668877
Circuit description: Impress AMPATH
Period: 21 Oct 05 - 20 Nov 05
Completion date: 28 Jun 2002

Terminal
Product: Frame Express National
Circuit no: 5107654568877
Circuit description: Express AMPATH
Period: 21 Oct 05 - 20 Nov 05
Completion date: 28 Jun 2002

Terminal
Product: Frame Express National
Circuit no: 51056880977
Circuit description: Express Ompale
Period: 21 Oct 05 - 20 Nov 05
Completion date: 28 Jun 2002

This post has been edited by nkateko: 14 February 2007 - 07:26 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1