•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,575 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,604 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 2371 | Replies: 14 | Solved
![]() |
•
•
Join Date: Oct 2007
Posts: 14
Reputation:
Rep Power: 2
Solved Threads: 0
I am writing a program where I need to capitalize the first letter of each word in a text file. Example of information in the text file would be:
this is the first line
this is the second line
this is the third line
I have written a code that gives me back the following information:
This Is The First Line
this Is The Second Line
this Is The Third Line
I cannot figure out how to get the first word in the second and third lines capitalized.
I have used a split separator to create the array, the separator is a space. I know it is not capitaizing those letters because there is no space at the beginning of the line, but have no idea what to do to fix the problem. Can someone please help me? Thank you so much
this is the first line
this is the second line
this is the third line
I have written a code that gives me back the following information:
This Is The First Line
this Is The Second Line
this Is The Third Line
I cannot figure out how to get the first word in the second and third lines capitalized.
I have used a split separator to create the array, the separator is a space. I know it is not capitaizing those letters because there is no space at the beginning of the line, but have no idea what to do to fix the problem. Can someone please help me? Thank you so much
Oopsie sorry about that. I was on my linux box 
You probably have to select the multiline option on the text box...

vb Syntax (Toggle Plain Text)
Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objStreamReader As StreamReader Dim strLine As String 'Pass the file path and the file name to the StreamReader constructor. objStreamReader = New StreamReader("C:\foo.txt") 'Read the first line of text. strLine = objStreamReader.ReadLine 'Continue to read until you reach the end of the file. Do While Not strLine Is Nothing Dim bar As String If (strLine.Length > 0) Then bar = strLine.Substring(0, 1).ToUpper & strLine.Substring(1, strLine.Length - 1) 'Write the line to the textbox. TextBox1.Text = TextBox1.Text & bar & System.Environment.NewLine End If 'Read the next line. strLine = objStreamReader.ReadLine Loop 'Close the file. objStreamReader.Close() Console.ReadLine() End Sub End Class
You probably have to select the multiline option on the text box...
Last edited by iamthwee : Oct 26th, 2007 at 4:46 pm.
... the hat of 'is this a cat in a hat?'
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Anyone a VB.NET Guru? (VB.NET)
- Windows .NET RC1 (Windows NT / 2000 / XP / 2003)
- digital imaging in 2k/.net? (Windows NT / 2000 / XP / 2003)
- .NET Speech SDK for ASP.NET (ASP.NET)
- Visual Basic.net (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: How to overcoming a .NET ListView CheckBoxes quirk
- Next Thread: text boxes to validate input values



Linear Mode