Wednesday, 16 March 2011

9.4

Code for 9.4 task - There is 2 parts to this task, they will be seperated by a space:


Public Class Form1

    Private Sub btnNewName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewName.Click
        Dim Name, NewName As String
        Name = txtname.Text
        NewName = UpperCaseFirstLetter(Name)
        lblNewName.Text = NewName
    End Sub
End Class


TASK 2
Module Module1
    Function UpperCaseFirstLetter(ByVal OldString As String) As String
        Dim FirstLetter As Char
        Dim NewString As String
        FirstLetter = Char.ToUpper(OldString.Substring(0, 1))
        Mid(OldString, 1, 1) = FirstLetter
        NewString = OldString
        Return NewString
    End Function
End Module

No comments:

Post a Comment