CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • CS0149: Method Name expected

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    6254
  • Date Created
    Thursday, June 16, 2022
  • Last Updated
    Friday, August 19, 2022
  • This Article Has been Viewed
    442 times
  • Short Desc
    Programming in VB.NET or C#, which do we use, parenthesis or brackets?
  • Details
    When crossing over from one programming language to another, in this case, we are working on both VB.NET and C#; we are bound to run into issues. When wrapping our variable names, it can be tricky when you jump back and forth and forget which language you are working with.
  • Recreate Issue
    In VB.NET, we use the parenthesis GetName(v). However, that is not the case for C#.
    In this example, we have a mixture of both V.NET and C#, but we can only use one language.

    Scenario #1
    (Ignore the open and closing brackets in these examples)
    <%
    Response.Write(getFile + "(" + GetName(v) + ") Uploaded Successfully!<br />");
    %>


    Scenario #2
    (C#) In this example, the recordset is not formatted correctly for C#. The only thing that changed in this line of code to make it C# is the semi-colon at the end. This is not all that is needed; we see this because of the error.
    <%
    String strTag = rsTag("TagName");
    %>
  • Resolve Issue
    We need to change the parenthesis to brackets for C#.
    Demonstrated below are the uses of both C# and VB.NET.

    Scenario #1
    <%

    'VB
    Response.Write(getFile & "(" & GetName(v) & ") Uploaded Successfully!<br />");
    'C#'
    Response.Write(getFile + "(" + GetName[v] + ") Uploaded Successfully!<br />");

    %>


    Scenario #2
    (C#) Adding (string) to the beginning and brackets around our Column Names will resolve this issue.
    <%
    String strTag = (string)rsTag["TagName"];
    %>