473,383 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ASP.NET (VB) Class syntax

gchq
96
Hi there

The .replace function has to be used a lot to stop special characters being inserted into the DataBase (along with HTML coding) - sooooo I thought instead to this long string being inserted so often I could define a class and re-use the code (also if I need to add another .replace, so much easier). Simple eh? Seems not (sigh)!

I'm looking for the correct syntax to set up a class (or classes) with functions to take the string and return it with the special characters replaced - e.g.

Expand|Select|Wrap|Line Numbers
  1. Imports Microsoft.VisualBasic
  2. Imports System
  3.  
  4. Public Class HTML_Out
  5.     Public Sub New(ByVal vString As String)
  6.         ReturnString(vString)
  7.     End Sub
  8.     Function ReturnString(ByVal vText As String)
  9.         Dim vReturnString As String = vText.Replace("<", "[").Replace("'", "~#").Replace("&", "*#").Replace(">", "]")
  10.         Return vReturnString
  11.  
  12.     End Function
  13.  
  14. End Class
  15.  
  16.  

I would have thought that that this could have been called with

Expand|Select|Wrap|Line Numbers
  1. Dim vConverted as new HTML_Out(SomeTextString)
  2.  
A shove in the right direction would be appreciated....
Jan 26 '08 #1
2 1002
kenobewan
4,871 Expert 4TB
You need to declare the class and then use its functions, something like:
Expand|Select|Wrap|Line Numbers
  1. Dim HTML_Out as new HTML_Out
  2. Dim vConverted as string  = HTML_Out.ReturnString(somestring)
I'll leave the class up to you to fix, if you strike any problems. HTH.
Jan 26 '08 #2
gchq
96
Thank you kenobewan - that was it!
Jan 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

43
by: Spare Change | last post by:
This is a recommendation to Microsoft. VB.net and c# are almost exactly equivalent. I know why Microsoft invented VB.net -- to wean old style VB6 scripters into a true OO world: .Net. But...
5
by: Saga | last post by:
Hi all, I just read the thread by the same name posted on Jun 15, 9:45 AM, but I am looking at it from a different point of view. I came across this question in terms of functionality. Are VB and...
10
by: GaryB | last post by:
I am experienced in .net development using VB. Is there any material available geared to someone that knows .NET and VB.NET to learn C#? thanks, Gary
72
by: Robin Tucker | last post by:
I need to find some documents/research for my manager about VB.NET v C# use. I've noticed that there are many more people using C# than VB.NET, that there seem to be more job vacancies specifying...
53
by: Jon S via DotNetMonster.com | last post by:
Hi all, I'm planning on developing an ASP.NET web site. I know both VB.NET and C# but am unsure on which would be more useful to develop an ASP.NET site with? Also I maybe looking to become a...
19
by: Chris Dunaway | last post by:
Just got my hands on Whidbey. Here are a few interesting changes that you may not be aware of: 1. Continue statement on Do, For and While commands 2. Default Instances of certain classes...
182
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
62
by: zacks | last post by:
A co-worker where I work is proposing all future code devopment be done in Visual C#. Here is his assessment of VB: VB.NET is hack as far as the CLR(Common Language Runtime) goes. It was...
15
by: Manny Chohan | last post by:
Hey Guys, Can some one tell me why is there more demand for C# vs VB .NET? Personally i have programmed in VB .net a little bit and have found it easier to use. Is there any hidden secret...
0
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.