![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jun 2005
Location: glasgow
Posts: 4
Rep Power: 0
![]() |
html tag extractor problem
Hi,
As youcan probably guess im new here, im also quite new to the whole programming thing but have been beggining to learn vb.net due to the beta being free! Anyway, Im trying to make a simple application to help making html pages in notepad and im stuck with making a button to extract html tags from a rich text box, remove them from it and put them into another box. this bit of code works fine up until a certain point when it starts returning stuff that quite clearly isnt right ie. if the text in rtb1 is: <html> <head> <title>Michael's site</title> </head> <body bgcolor=black text=F0AF link=yellow alink=red vlink=F0AF> <font face="verdana"> <h1 align=center>Hello and welcome</h1> at the third click it puts "<title>m" into the second textbox i cant for the life of me work out whats going on! <code> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim sparvar Dim strlen Dim htmlstr Dim rbloc Dim lbloc Dim newvar rbloc = 0 lbloc = 0 sparvar = "" htmlstr = "" strlen = 0 htmlstr = rtb1.Text strlen = Len(htmlstr) lbloc = InStr(htmlstr, "<") rbloc = InStr(htmlstr, ">") sparvar = Mid(htmlstr, lbloc, rbloc) htmlstr = Mid(htmlstr, rbloc + 1, strlen) rtb1.Text = htmlstr newvar = rtb2.Text rtb2.Text = newvar + " " + sparvar End Sub </code> Also as a side note, are there any naming conventions for variables and objects? Thanks Mike |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|