Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Help with visual basic

OP fujirio

6th February 2014, 03:50 AM   |  #1  
OP Senior Member
Thanks Meter: 23
 
179 posts
Join Date:Joined: Feb 2011
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
6th February 2014, 03:56 AM   |  #2  
veeman's Avatar
Senior Member
Flag Minnesota
Thanks Meter: 1,515
 
9,416 posts
Join Date:Joined: Apr 2012
More
Try using the CODE tags around the text so it gets formatted correctly. Or paste it here and post the link http://pastebin.com/
6th February 2014, 04:02 AM   |  #3  
OP Senior Member
Thanks Meter: 23
 
179 posts
Join Date:Joined: Feb 2011
Quote:
Originally Posted by veeman

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
7th February 2014, 03:39 AM   |  #4  
kibermaster's Avatar
Junior Member
Flag Moscow
Thanks Meter: 1
 
12 posts
Join Date:Joined: Oct 2010
More
Quote:
Originally Posted by fujirio

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
9th February 2014, 12:58 AM   |  #5  
OP Senior Member
Thanks Meter: 23
 
179 posts
Join Date:Joined: Feb 2011
Thumbs up
Quote:
Originally Posted by kibermaster

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
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes