Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jun 7th, 2005, 4:56 AM   #1
Mikeshaw
Newbie
 
Join Date: Jun 2005
Location: glasgow
Posts: 4
Rep Power: 0 Mikeshaw is on a distinguished road
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
Mikeshaw is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:39 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC