Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3784440
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:22:39+00:00 2026-05-19T11:22:39+00:00

Hey everyone, I’m a complete newbie to ASP .NET programming. I’m trying to get

  • 0

Hey everyone, I’m a complete newbie to ASP .NET programming. I’m trying to get a simple script running which takes string input from two text boxes, converts them to integers and checks that the process happened succesfully and then adds the two and inserts into the text box in the page.

I can get it working in VB.Net, but the reason I am learning ASP.Net is to make an application in work, which must use C#.Net. Can someone help me as to why this works in VB and not C#? The code is below and the error message is:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1026: )
expected

Source Error:

Line 1: <%@ Page Language=”C#” %>

Line 2:

Line 3: Sub btnConvert_Click(sender As Object, e As EventArgs)

Line 4: Try

Line 5: lblToInt1.Text = cint(txtValue1.Text)

<%@ Page Language="C#" %>
<script runat="server">
    Sub btnConvert_Click(sender As Object, e As EventArgs)
      Try
        lblToInt1.Text = cint(txtValue1.Text)
      Catch
        lblToInt1.Text = "Could not convert to Integer"

      End Try

        Try
        lblToInt2.Text = cint(txtValue2.Text)
      Catch
        lblToInt2.Text = "Could not convert to Integer"

      End Try
        lblToInt3.Text = cint(txtValue1.Text)+cint(txtValue2.Text)
    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <p>
            Text Value 1: 
            <asp:TextBox id="txtValue1" runat="server"></asp:TextBox>
        </p>
        <p>
            Text Value 2: 
            <asp:TextBox id="txtValue2" runat="server"></asp:TextBox>
            &nbsp;<asp:Button id="btnConvert" onclick="btnConvert_Click" runat="server" Text="Do it!"></asp:Button>
        </p>
        <p>
            Convert to Integer produces 1: 
            <asp:Label id="lblToInt1" runat="server"></asp:Label>
        </p>
        <p>
            Convert to Integer produces 2: 
            <asp:Label id="lblToInt2" runat="server"></asp:Label>
        </p>
        <p>
            Total of your 2 numbers: 
            <asp:Textbox id="lblToInt3" runat="server"></asp:Textbox>
        </p>
    </form>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:22:40+00:00Added an answer on May 19, 2026 at 11:22 am

    You just said that the page will use C# as a language, but the code is still in VB.

    The equivalent C# code will be something like:

    void btnConvert_Click(object sender, EventArgs e)       
    {
       try
       {
          lblToInt1.Text = int.Parse(txtValue1.Text).ToString();
       }
       catch //this could be replaced by a single call to int.TryParse
       {
          lblToInt1.Text = "Could not convert to Integer";
       }
       // etc, etc...
    }
    

    Find a nice C# / asp.net reference, and start from the provided examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone I am trying to get back into Spring programming on tomcat6. Can
Hey everyone, I am trying to run the following program, but am getting a
Hey everyone. I'm trying to make a swing GUI with a button and a
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey everyone. Hopefully I can explain this correctly. I have some URL's which I
Hey everyone I am trying to .submit some values with ajax response and i
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey everyone, I'm working on a PHP application that needs to parse a .tpl
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also
Hey everyone. So what i am looking to do is achieve a cleaner url

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.