|
-
Aug 16th, 2002, 09:36 PM
#1
Thread Starter
New Member
finding text in quotes
hi... i'm trying to make a compiler, with my own syntax... so far i have two textboxes and a button, just for a test. under the button:
dim startwrite as integer
if lcase(mid(textbox1.text, 1, 4)) = "text" then
startwrite = startwrite + 7
textbox2.text = mid(textbox1.text, startwrite)
end if
but i want multi line syntax, such as
cap "hello, world!";
text "hello, world!";
var name;
get name; nextline;
text "hello, " name;
something like that for my syntax... but i cant figure out how to do it! i think it has something to do with the start point, and having multi line syntax, but im not sure... any help would be appreciated!!!
-
Aug 19th, 2002, 07:10 PM
#2
Member
Visual Basic.Net's Textbox has another property called Lines. It's an array of strings that each member of it contains one line of the Textbox's text. You can use it like:
Dim i As Integer
Dim startwrite As Integer
For i=0 to Textbox1.Lines.Getupperbound(0)
If Lcase(Mid(Textbox1.Lines(i), 1, 4)) = "text" Then
startwrite = startwrite + 7
Textbox2.Text = Mid(Textbox1.Lines(i), startwrite)
'For multi line support for Textbox2:
'Textbox2.Text = Textbox2.Text & Mid(Textbox1.Lines(i), startwrite) & vbNewLine
End If
Next i
Don't let the Getupperbound function scares you! It accepts the number of a dimension in an array and returns index of the last item in that dimension.
Good luck,jazzyfunk
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|