Click here to Skip to main content
15,921,210 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hello
what is the code for space between words in text file space =20 blank please answer in vb.net2010
Posted
Comments
OriginalGriff 28-Mar-12 5:58am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.

If you want fix the width of each column of text, then the following code can be used
VB
Dim animals As String() = New String() {"Cat", "Dog", "Horse"}
Dim fruits As String() = New String() {"Apple", "Banana", "Grapes"}

Dim line As String
Dim sb As New StringBuilder()
Dim spaces As New String(" "C, 20)

Dim i As Integer = 0
While i < animals.Length AndAlso i < fruits.Length
'20 in {0,20}, defines the width of the column
'If it is negative i.e. -20, then the text is left aligned
'within the column otherwise it is right aligned in the column
	'line = String.Format("{0,20}{1,20}" & vbLf, animals(i), fruits(i))
	line = String.Format("{0,-20}{1,-20}" & vbLf, animals(i), fruits(i))
'If 20 spaces are to be introduced between two words then
'the following code can be used.
	'line = String.Format("{0}{1}{2}" & vbLf, animals(i), spaces, fruits(i))
	sb.Append(line)
	i += 1
End While
System.IO.File.WriteAllText(fileName, sb.ToString())
 
Share this answer
 
You should write your own code , with the help of string operation of vb.net , and file handling.

If you having problem at any point , you can ask .....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900