Jess
January 27th, 2013, 03:09 PM
I have this code
Public Class splitterForm
Dim txtName As Object
Dim output As Object
Private Sub splitSentence(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAnalyze.Click
Dim fullName, firstName, lastName As String
Dim m, n As Integer
fullName = txtName.Text
n = fullName.IndexOf(" ")
firstName = fullName.Substring(0, n)
lastName = fullName.Substring(n + 1)
m = lastName.Length
output.AppendText("First Name: " & firstName & vbCrLf)
output.AppendText("Your last name has " & m & " letters." & vbCrLf))
Dim fullName As String = StrReverse(fullName)
output.AppendText("This is your full name reversed: " & fullName & vbCrLf))
End Sub
End Class
I'm trying to follow an example in the textbook, to create a popup with a textbox where I put in my name and it generates some results, but every time I run it, I don't get what I should. It says there were some build errors. I don't understand AT ALL what I'm missing. I'm using Visual Basic 2010 at the moment, have it open...am I supposed to do something with the design?
I added in
Dim txtName As Object
Dim output As Object
because it says they weren't declared. It doesn't say this in the book, so I'm a bit confused
Public Class splitterForm
Dim txtName As Object
Dim output As Object
Private Sub splitSentence(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAnalyze.Click
Dim fullName, firstName, lastName As String
Dim m, n As Integer
fullName = txtName.Text
n = fullName.IndexOf(" ")
firstName = fullName.Substring(0, n)
lastName = fullName.Substring(n + 1)
m = lastName.Length
output.AppendText("First Name: " & firstName & vbCrLf)
output.AppendText("Your last name has " & m & " letters." & vbCrLf))
Dim fullName As String = StrReverse(fullName)
output.AppendText("This is your full name reversed: " & fullName & vbCrLf))
End Sub
End Class
I'm trying to follow an example in the textbook, to create a popup with a textbox where I put in my name and it generates some results, but every time I run it, I don't get what I should. It says there were some build errors. I don't understand AT ALL what I'm missing. I'm using Visual Basic 2010 at the moment, have it open...am I supposed to do something with the design?
I added in
Dim txtName As Object
Dim output As Object
because it says they weren't declared. It doesn't say this in the book, so I'm a bit confused