Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,769,453 Members 42,390 Now Online
XDA Developers Android and Mobile Development Forum

Help with visual basic

Tip us?
 
fujirio
Old
#1  
Senior Member - OP
Thanks Meter 23
Posts: 179
Join Date: Feb 2011
Default Help with visual basic

can some one help me find the errors on this program

Public Class DemoUpper

Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
Const strLowerCase As String = "visual basic"
strLowerCase = strLowerCase.ToUpper
txtOutput.Text = strLowerCase
End Sub
End Class
 
veeman
Old
#2  
veeman's Avatar
Senior Member
Thanks Meter 1514
Posts: 9,416
Join Date: Apr 2012
Location: Minnesota
Try using the CODE tags around the text so it gets formatted correctly. Or paste it here and post the link http://pastebin.com/
 
fujirio
Old
#3  
Senior Member - OP
Thanks Meter 23
Posts: 179
Join Date: Feb 2011
Quote:
Originally Posted by veeman View Post
Try using the CODE tags around the text so it gets formatted correctly. Or paste it here and post the link http://pastebin.com/
http://pastebin.com/0Qw1kKJ0#

Code:
Public Class DemoUpper

    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles   btnDisplay.Click
        Const strLowerCase As String = "visual basic"
        strLowerCase = strLowerCase.ToUpper
        txtOutput.Text = strLowerCase
    End Sub
      End Class
 
kibermaster
Old
#4  
kibermaster's Avatar
Junior Member
Thanks Meter 1
Posts: 12
Join Date: Oct 2010
Location: Moscow
Quote:
Originally Posted by fujirio View Post
http://pastebin.com/0Qw1kKJ0#

Code:
Public Class DemoUpper

    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles   btnDisplay.Click
        Const strLowerCase As String = "visual basic"
        strLowerCase = strLowerCase.ToUpper
        txtOutput.Text = strLowerCase
    End Sub
      End Class
You've declared "strLowerCase" as constant, so you can't assign a value to it, you can only read it. So, the working code should look like this:

Code:
Public Class DemoUpper

    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles   btnDisplay.Click
        Dim strLowerCase1 as string
        Const strLowerCase As String = "visual basic"
        strLowerCase1 = strLowerCase.ToUpper
        txtOutput.Text = strLowerCase1
    End Sub
      End Class
But also you can make it shorter like this:

Code:
Public Class DemoUpper

    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles   btnDisplay.Click
        Const strLowerCase As String = "visual basic"
        txtOutput.Text = strLowerCase.ToUpper
    End Sub
      End Class
 
fujirio
Old
#5  
Senior Member - OP
Thanks Meter 23
Posts: 179
Join Date: Feb 2011
Quote:
Originally Posted by kibermaster View Post
You've declared "strLowerCase" as constant, so you can't assign a value to it, you can only read it. So, the working code should look like this:

Code:
Public Class DemoUpper

    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles   btnDisplay.Click
        Dim strLowerCase1 as string
        Const strLowerCase As String = "visual basic"
        strLowerCase1 = strLowerCase.ToUpper
        txtOutput.Text = strLowerCase1
    End Sub
      End Class
But also you can make it shorter like this:

Code:
Public Class DemoUpper

    Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles   btnDisplay.Click
        Const strLowerCase As String = "visual basic"
        txtOutput.Text = strLowerCase.ToUpper
    End Sub
      End Class

wow thank you so much
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes