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.Knowledge Base
- Breadrumbs:
CS0149: Method Name expected
- 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"];
%>
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19544
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16825