hi i wants to create an dll file for removing blankspaces in a given string..........
here iam writing the code but it was not working.....
please give me the correct code....
here iam using asp.net with vb.net

Namespace fillblank
    Public Class Class1
        Private Sub blankspces()
            Dim a
            Dim done
            a = " "
            Do Until done
                If InStr(1, a, "  ") = 0 Then
                    done = True
                Else
                    a = a.Replace("  ", String.Empty)
                End If
            Loop
            'a.Trim.Replace(" ", String.Empty)
        End Sub
    End Class
End Namespace

please help me

kvprajapati commented: Stop! -1

Recommended Answers

All 4 Replies

The built-in feature of .NET String class has methods to remove spaces in a given string. Why do you want to go for a custom method?

String str1 = "This is a string"
String str2  = str1.Replace(" ", String.Empty)

Here str2 will have the string value "Thisisastring".

The built-in feature of .NET String class has methods to remove spaces in a given string. Why do you want to go for a custom method?

String str1 = "This is a string"
String str2  = str1.Replace(" ", String.Empty)

Here str2 will have the string value "Thisisastring".

hi here i have to remove so many blank spaces that occurs within string in more than 10 forms....so i want to create an dll file ,by calling tha dll file the blank spaces withinn a string to be removed in every form........
so please give me the code for removing blank spaces for creartion of a dll file..........

kanuri1,

Please read the rules before posting again, in particular the 'keep it organized' one - Do not flood the forum by posting the same question more than once (ie in multiple forums). If you hit 10 infraction points your account gets an automatic ban, so it is worth obeying the rules if you want to continue to benefit from DaniWeb help.

Double threads:

1. http://www.daniweb.com/forums/thread261491.html
2. http://www.daniweb.com/forums/thread261509.html

Hi

I had same problem.You can use following code.It will help you.

Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\scripts\test.txt", ForReading)

Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strLine = Trim(strLine) & vbCrLf
strText = strText & strLine
Loop

objFile.Close

Set objFile = objFSO.OpenTextFile("c:\scripts\test.txt", ForWriting)
objFile.Write strText
objFile.Close

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.