Solved

Dividing Text Lines

Posted on 2004-08-08
4
213 Views
Last Modified: 2010-04-17
I'm working with VB6, and trying to divide whatever text is in the textbox into sections.
for example lets say the text box contains ascii art:

---------------------   <- line1
                }}}         <- line2
}}}   }}}                 <- line3
}}}   }}}    }}}         <- line4
}}}}}}}}    }}}         <- line5
}}}  }}}}   }}}          <- line6
                              <- line7
--------------------     <- line8

I need to do something like this:

SendtoChat Line1
SendtoChat Line2
SendtoChat Line3
...etc

Thank You

0
Comment
Question by:andyakira
  • 2
4 Comments
 

Expert Comment

by:dkinjal
ID: 11750876
hi andyakira,
its easy to do its... just have the code below:

--------------------------------------------------------
Dim fname As String, str As String,fno as Integer
fname = "c:\windows\desktop\new.txt"
fno = FreeFile()
Open fname For Input As #fno
While Not EOF(1)
     Line Input #fno, str
     SendToChat str
Wend
-------------------------------------------------------
 
 You need to change the code according to your requirement.. I mean, in particular, the path should be replaced by your file path.... Well hope it will solve your matter...
-Kinjal
0
 
LVL 18

Accepted Solution

by:
JR2003 earned 30 total points
ID: 11751041
1 Convert the text in the multiline text box into a variant array.
2 Iterate through the array sending the individula lines to chat:

Private Sub Command1_Click()

    Dim MyLines As Variant
    Dim i As Long
    MyLines = Split(Text1.Text, vbNewLine)
    For i = LBound(MyLines) To UBound(MyLines)
        'SendtoChat MyLines(i)
        Debug.Print MyLines(i)
    Next i

End Sub
0
 

Author Comment

by:andyakira
ID: 11759185
Thank you both for helping, greatly appreciated. keep up the good work guys!

 JR2003, the code works perfectly, i just put it in and it worked with hardly any adjustments done. TY
0
 

Expert Comment

by:dkinjal
ID: 11760205
ohh.. i was just in hurry and merged up both the questions and felt that this question is for extracting from file.... the code i posted was for that... sorry for that... bye
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now