Return Type Of Parameter Is Not CLS-compliant
Jun 28, 2010
I have a base class with a static function that returns a typed dataset. I have several classes that inherit the base class with a non-static function that returns the same typed dataset. On these methods I get the 'Return type of parameter yadda
is not CLS-compliant' I don't understand where this is coming from. I have non unsigned integers/etc. in this dataset.
View 2 Replies
ADVERTISEMENT
Jun 2, 2010
I have the following property defined. MyLibrary.PumpSignal is an enum as follows:
Public Enum PumpSignal As Integer
PumpOff = 0
PumpOn = 1
End Enum
[Code].....
.NET keeps complaining that the Return value from PumpState is no cls-compliant.
View 1 Replies
May 25, 2011
Is it possible to replace these two functions
Function f1 (s As String) As class1()
Dim a() As String = Split(s)
Dim b(UBound(a)) As class1
[code].....
View 3 Replies
Mar 9, 2011
I want to have a "template" function that can receive different parameter and a type parameter, like:[code]But Vb told me that tupeList is not defined... is there a way I can do that?
View 2 Replies
Jun 7, 2011
I have a storedproc accepts parameters in XMLtype as
CREATE OR REPLACE PROCEDURE GetDetails(
p_para IN XMLTYPE,
[code].....
View 1 Replies
Nov 19, 2010
i am getting all filenames from a directory.parsing out the directory names & the .vb extension then converting those filesnames to classes.Every file in the LPCriteria direcotry is its own class with a "Evaluate" function.[code]
View 1 Replies
Nov 23, 2009
I have a copy function that I'd like to override in subclasses to return the type of the subclass. Here are my interfaces:
Public Interface IBase(Of T)
Function Copy() As T
End Interface
[Code]....
View 4 Replies
Apr 22, 2010
I have a delegate and its event in C# as below:
public delegate UsernameCredentials UsernameRequiredEventHandler( object sender, string endpoint );
public event UsernameRequiredEventHandler UsernameRequired;
On Converting the above code in VB.Net as follow :
Public Delegate Function UsernameRequiredEventHandler(ByVal sender As Object, ByVal endpoint As String) As UsernameCredentials
Public Event UsernameRequired As UsernameRequiredEventHandler
I am getting error on the above line saying that "Events cannot be declared with a delegate type that has a return type".I understand that this is not supported in VB.Net.
View 3 Replies
Aug 21, 2011
Here's a simple code snippet of a larger function as an example.
Using conn as New SqlConnection("conn string")
Using find as new SqlCommand("ExampleProc",conn)
Dim rParam as new SqlParameter("@RESULT",SqlDbType.Int)
[code]....
I know the Output parameter is returned after the SqlDataReader is closed. From what I think I know, the Using statement will call .Dispose on the SqlDataReader, so will that basically wipe out the Output parameter? If so, what is the best method to call a SqlDataReader that also contains Output parameters that closes and disposes everything correctly? Let me add that based on what I've read you only have access to the Output parameter using a SqlDataReader after you call .Close on the SqlDataReader.
View 2 Replies
Nov 2, 2010
I'm writing a solution where the data entities are passed to clients using datasets through a WCF service, with nHibernate as ORM. My predecessor has written some translator classes, converting datasets to entities and vice versa. In most cases he's declared the return object as a parameter for the object.
For example:
Public Shared Function CreateEntity(ByVal ds As DataSetObject, ByVal entity As EntityObject) As EntityObject
Dim row As ds.EntityObjectRow = ds.EntityObject(0)
entity.Id = row.Id
[code]....
He's not with the company anymore, so I can't ask him why he's done it this way. Hence my question here. Is there some performance gain, or traceablity thing with nHibernate by using the first implementation rather than the latter?
View 1 Replies
Apr 26, 2010
I have created my own ListViewItem class, and added some custom properties to it of attributes. What I have at the moment is a tooltip which shows all of those custom properties (about 18 of them).What I want to be able to do is if multiple are selected, to show a tooltip, but if a property (say Title) for all of them is "My Title" it will show that, otherwise if they are different, I would like it to show "VARIES"Is there a way of declaring a parameter in my function and return a value? [code]
View 1 Replies
Jun 11, 2012
I need to create a function which have either 1 parameter with a string as data type or 2 parameters with double as data type.Something like the substring method.
View 2 Replies
Jul 9, 2009
I have an input parameter for my stored Proc, Instead of choosing available values from a drop Dwn, the customer wants an empty input box that when left blank returns all records. the parameter type is numeric(6,0) in the Db. I have not found a way to leave the input blank and retrieve all records. my default value for all records is '-99' and also is declared as the default value for the param in the proc.
View 1 Replies
Aug 15, 2011
I'm getting the following warning message... Return type of function 'ConnectionNew' is not CLS-compliant.
...for this function:
Public Function ConnectionNew(ByVal DataBaseName As String) As MySqlConnection
Dim connection As MySqlConnection = Nothing
[code].....
View 1 Replies
Feb 26, 2012
For each column in data table i want to add parameter with same data type as column data type. But looks it's not that simple.
Dim cmd As New SqlCommand
Dim dType As New System.Data.SqlDbType
For Each cl As DataColumn In DataTable1.Columns
[CODE]...
How can I do this?
View 4 Replies
Feb 17, 2010
I wrote a generic EventArgs class in my VB.NET solution:
Public Class EventArgs(Of T)
Inherits EventArgs
Private _eventData As T
[code].....
When I use it as in the following example, it says that e is not CLS-compliant.
Event MarketModeChanged(ByVal sender As Object, ByVal e As EventArgs(Of Integer))
View 2 Replies
Aug 5, 2009
I'm using LINQ to SQL as my data access layer for a new project.I have added my database tables to the designer and all is well.Whenever I use one of these classes in a function, Visual Studio warns me that 'Type xxxx is not CLS-compliant' or that 'Return type of function xxxx is not CLS-compliant' Is this a problem with the classes that LINQ to SQL generates? Does it matters? Can I disable these warnings anywhere? My VS error list is clogged up with these warnings making it hard to see anything else.
View 4 Replies
Apr 8, 2009
This is kind of two questions (one more specific than the other).If I have a method like this:[code]Can I qualify Foo against another type (for instance can I require that Foo be a String that also implements IInterface?).I'm imagining something vaguely similar to this:[code]Additionally, is there any way to qualify the Type parameter?For instance, can I require that the Type I take as a parameter is of a particular class tree?I should mention that I am using this in the context of a property of an attribute so the class declaration itself cannot be generic (this is purely focused on qualifying a method parameter rather than typing a class and its methods).
View 3 Replies
Mar 19, 2012
I did create a XDateTime class that is able to handle inaccurate date and time. This class has all the CType operators required to convert to and from a string and it has been fully tested during the last months.
[Code]...
View 1 Replies
Mar 7, 2010
I've searched for an answer and found some c#-examples, but could not get this running in vb.net:
I thought of something like the following[code]...
I know, I can create a new instance with the Activator.Create... methods, but how to create an array of this type or just declare a new variable?
View 3 Replies
Jan 4, 2011
I'm trying to create a function to parse out all values in a multidimensional Array with all but one dimension given. The details are not relevant, but for this function I need to return an one-dimensional Array containing values of the same type the original multidimensional Array has.To pass any Array with any dimension to my function, I declared the type of this parameter as Array. However, how would I create a new Array of that specific type (e.g. Integer)?Currently I have the following code:
Function GetRow(ByVal arr As Array) As Array
Dim result As (...) 'This should be Integer() if arr contains Integers, etc.
Return result
[code].....
View 1 Replies
Mar 10, 2011
Is it possible in VB to have a function that can receive diffrent parameter, like a String or a Integer or a custom class type?
View 4 Replies
Sep 25, 2009
Is it possible to have an optional parameter of the type list?Ex.
Private Function TestFunction(Optional ByRef MyList As List(Of Double))
The real problem is giving the list a default value. When dimming a new list, you can use the code below to give it a starting value:
Dim MyList As New List(Of Double)(New Double() {1, 2, 3, 4, 5})
But even after trying many variations of the above code, I cannot get it to work as an optional parameter.
View 16 Replies
May 20, 2011
I need type parameter overloading as such:[code..]
so that i can New Map(Of Human) and the compiler will automatically match it to Public Class Map(Of TKey, TValue) and if i new Map(Of String) the compiler will automatically match it to Public Class Map(Of TKey As IEquatable(Of TKey), TValue) (since String is an IEquatable(Of String))
Right now my solution is to give the class different names as such:[code...]
View 2 Replies
Mar 23, 2011
I'm trying to use the type Boolean for some parameter.
<AttributeUsage(AttributeTargets.Method, Inherited:=True, AllowMultiple:=False)>
Public Class MyAttribute
Inherits Attribute
[code].....
View 14 Replies
Dec 16, 2009
im making a function that disables controls except for a type of control i want to specify. how would I make the header of this procedure is my procedure should capture a control and a object of any type If I would call modUtilities.DisableControls(Panel_OwnerInfo, CheckBox_HasCell) is should disable all the controls inside Panel_OwnerInfo except for the CheckBox_HasCell Now I've done the disabling thing, but how would I specify the procedure parameter to recieve a class type?
[Code]...
View 1 Replies
Apr 12, 2011
I want to include an optional parameter in a function statement that is of the type Unit. For example:
Public Shared Function NewTable(Optional ByVal TableWidth As Unit) As Table
Optional parameters require a default value, but I cannot figure out how to set a default value for a Unit type.
View 7 Replies
Mar 21, 2012
As an OSS library author, I've always tried to make my stuff CLS compliant. But MS doesn't make this easy. They often put you in catch-22 situations, such as the following:You cannot have a protected variable differing only in case from the public property.You cannot have protected or public variables starting in an underscore or 'm_'. If you want to make a class really extensible, you often need to have protected variables matching public properties. Your least ugly exit is to add a suffix to the variable, like "Var" or "Value". That's nasty and unacceptable to me. I like clean code.I know of no .NET languages that don't support variables starting in an underscore, and I've used them in many places where the variable needs to be visible to subclasses.
I'm tired of the warnings, and I'm planning on turning off CLS compliance at the assembly level on my 30+ C# libraries.Are there any actual problems with turning off CLS compliance on libraries? Any real problems with doing this? Microsoft has issued unheedable guidance on software for decades, with less that 5% of it being worth the bytes it was encoded in. I can't find any evidence that this best practice has any real effect on anything. But, to be careful, I'm checking. And no, this is not a duplicate of the inverse of this question: Any reason not to mark a DLL as CLSCompliant?I'm looking for actual results and effects here, not the advice of a MS intern. For example, if IronPython, IronRuby, or F# are unable to read or write a variable starting with an underscore, that's an effect, although it would only cause a problem for users subclassing certain objects. If a language or tool is completely unable to use an assembly unless it is marked CLS compliant, now that's a big deal.
View 2 Replies
Mar 12, 2011
This question is more out of curiosity than a project requirement or a problem.I have a Non-CLS compliant code in one language (say C#), and I need to use it like that only in my current language (across projects, so making internal is not a choice), and at the same time want to allow other languages (say VB) to be able to call the conflicting implementations without generating compile time error.
For instance,
//C#
public class SecurityService
[code].....
View 3 Replies
Apr 2, 2009
is it possible to have a webresource output a url string that's XHTML compliant?For example, a typical webresource.axd reference will be something like:[code]
View 7 Replies