.net - 'ObjectDataSource1' Could Not Find A Non-generic Method 'getCOMDLs' That Has Parameters:
Sep 27, 2010
Getting this error message and I am not able to figure out why. Here is my code:
<asp:TextBox ID="searchParam" Width="250px" runat="server"></asp:TextBox><asp:button ID="btnSearch" runat="server" Text="Search" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="getCOMDLs" TypeName="NewEmployee">
[Code]...
View 1 Replies
ADVERTISEMENT
Oct 7, 2010
I have been using a pretty slick generic invoke method for UI updating from background threads. I forget where I copied it from (converted it to VB.NET from C#), but here it is: Public Sub InvokeControl(Of T As Control)(ByVal Control As t, ByVal Action As Action(Of t))
[Code]....
View 1 Replies
Oct 19, 2010
Consider a MyForm class that contains a shadowed implementation of Show(). It also contains a CreateForm() method, which accepts an instance of the form and calls the shadowed sub:
[Code]....
View 3 Replies
Apr 13, 2012
Consider:
Public MustInherit Class Column
Public ReadOnly Property ReturnSomethingUseful() As Object
Get
'return something useful
[code]....
But this gives the following error:
Public Overrides Function ParseValue(sValue As String) As Boolean'
cannot override 'Public Overridable Function ParseValue(sValue As String) As Object'
because they differ by their return types.
I accept that you can't do this, but I'd like to be able to preserve the semantics of what I'm. trying to do, which is to have an untyped version that deals with Object, but a typed version in derived classes that knows about the specific type T.
View 2 Replies
Sep 16, 2010
Write an overload for every numeric type or if possible constrain a generic extension method to just numeric types.
View 2 Replies
May 23, 2010
Using the following code:
[Code]...
View 6 Replies
Apr 28, 2010
I am really trying to follow the DRY principle. I have a sub that looks like this?
Private Sub DoSupplyModel
OutputLine("ITEM SUMMARIES")
Dim ItemSumms As New SupplyModel.ItemSummaries(_currentSupplyModel, _excelRows)
ItemSumms.FillRows()
[Code]...
View 4 Replies
Jun 7, 2009
I have a class myClass. MyClass has a property myName. I have a generic list myList(of myClass). I have to check if value of myName in all myClass objects in myList is same and is equal to a string myString. I have created a method:
Private Function IsMatching(ByVal objMyClass As MyClass, ByVal strMyString As String) As Boolean
If objMyClass.MyName = strMyString Then
Return True
Else
Return False
End If
End Function
Now I want to use is TrueForAll method of Generic list. How can I use it ?
If there was No second Parameter in IsMatching method, I could have simply used
myList.TrueForAll(AddressOf IsMatching)
But since there is a parameter strMyString, I dont understand how can I use IsTrueForAll method. How can I use IsTrueForAll method in this scenario.
View 2 Replies
Jul 29, 2011
Currently my code has the following properties:
[Code]...
View 3 Replies
Aug 5, 2009
I have a problem with the VB.NET compiler failing to compile a class (in a separate C# assembly) which contains two overloads of a method with generic arguments. The equivalent code in C# compiles against the same assembly with no errors. Here are the two method signatures:
protected void SetValue<T>(T newValue, ref T oldValue)
protected void SetValue<T>(T? newValue, ref T? oldValue) where T : struct
Here is the code to three assemblies that demonstrate the problem. The first is the C# assembly with a Base class that implements the generic methods. The second is a C# class derived from Base and calls both overloads of SetValue correctly. The third is a VB class also derived from Base, but fails to compile with the following error message:
[Code]...
Am I doing something wrong in the VB code, or are C# & VB different when it comes to generic overload resolution? If I make the method arguments in Base non-generic then everything compiles correctly, but then I have to implement SetValue for every type that I wish to support.
View 2 Replies
May 30, 2012
After looking at this thread.>>
How to randomize the alphabet I have decided to make it into an extension method for a String and a List.
Note: Please see the following post if you are still using VB.Net 2002, 2003 or 2005
this code is for use with 2008 and later versions of VB.Net
String.Mix and also List.Mix I was trying to write a generic extension method for every Enumerable(Of T)
I settled on just doing it for a STRING
[Code]...
View 16 Replies
Feb 19, 2011
I am trying to print (to a text file) the fragmentation information give by Win32_Volume class using the DefragAnalysis method and have come up with the following VB.NET code:
Dim objReader As StreamWriter
objReader = New StreamWriter(FolderBrowserDialog.SelectedPath + "FragInfo" + "_" + CreationDate + ".txt")
Dim colItemsFragInfo As New ManagementObjectSearcher("rootCIMV2", "Select * from Win32_Volume where DriveType = 3")
[code]....
You do not need to defragment this volume.However executing this in Visual Studio returns the below:
Volume size: MB
Cluster size: MB
You do not need to defragment this volume.The point here is though it does NOT work under Windows Server 2008 R2, but does work under Windows Server 2003 (when executed in Visual Studio), WMI Code will work regardless of platform.
NB: i have played with the "Console.WriteLine" and changed it to "Debug.WriteLine" to output value to immediate window.
View 1 Replies
Oct 13, 2011
i m getting a collection of data in list's object. And from this list i want to get the maximum id.`
Dim objinfo As List(Of AlbumInfo) = objPhotos.GetPhotos_Alb_ID(Me.ModuleId, hdd_AlbID.Value)
Dim Photo_Image As String = ""
Dim str As String = Photo_Image & fu_Photo.PostedFile.FileName.Substrng(fu_Photo.PostedFile.FileName.LastIndexOf("."))
[code]....
this returns the "0"th positions id from Convert.ToString(objinfo.Item("0").Photo_Id + 1)but i want to get the last item's id.
View 17 Replies
Jun 8, 2009
I am trying to call a method which has two parameters using thread. How can I do this? If I pass parameter to my thread.start() method, it is giving error.
View 1 Replies
Apr 17, 2011
Is there a Visual Basic.NET method that can convert method parameters into an array?[code]...
View 2 Replies
Oct 19, 2011
I am writing a alternative to GDI, and rigth now i am working at a logging function. The idea is that while you use the class to draw, it will write a logg of what you have done, which can be used to draw it back later. In that way i would be able to store a drawing with weary little disk usage.
[Code]...
View 1 Replies
Aug 20, 2009
How would I go about passing parameters to a method? I would want to do the following:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ReceivingUdpClient = New System.Net.Sockets.UdpClient(6767)
Dim receiveBytes As [Byte]() = ReceivingUdpClient.Receive(RemoteIpEndPoint)
Dim ThreadReceive As New System.Threading.Thread(AddressOf receiveMessages(receiveBytes))
ThreadReceive.Start()
End Sub
Private Sub receiveMessages(ByVal receiveBytes As Byte())
'INSERT CODE
<br/>
End Sub
View 3 Replies
Feb 1, 2012
How to pass a object that is initialized from a derived class to a method that has Interface as the parameter?[code]...
View 1 Replies
Jul 27, 2010
I'm trying to use the Shell method however I'm having trouble because I want to open the file a specific way.
For example,
Shell("C:x.exe" -window)
However this gives an error.
View 4 Replies
Jun 19, 2009
I have 3 similar functions, that only change based on numeric type:
<Extension()> _
Public Function ToNullableShort(ByVal str As String) As Short?
Dim intReturn As Short
[Code].....
I was trying to make a generic function out of this, but couldn't do it. How can I make a generic function that will take a specific T and make it a Nullable(of T)?
View 2 Replies
Dec 16, 2010
I have a custom list that inherits Generic.List and it has a method for deselecting all of the members named DeselectAll It has looked like this for a few weeks and has worked fine.
Public Sub DeselectAll()
MyBase.ForEach(Function(p As Publipostable) p.ModeEnvoiChoisi = Nothing)
End Sub
Today, it stopped working ?!? I reverted to an earlier version using delegates and that works fine...
Public Sub DeselectAll()
MyBase.ForEach(AddressOf DeselectModeEnvoi)
End Sub
[code]....
Edit: Stopped Working meaning it no longer sets the property p.ModeEnvoiChoisi to Nothing on each item in the list. The DeselectAll method gets called, but all the items retain their previous values...
View 1 Replies
Feb 16, 2009
I'm trying to search a generic list of 'User' business objects which has a property called 'Username': If (From u In colUsers Select u.Username Where Username.Equals(strUsername)).Count > 0 ThenI keep getting:Delegate to an instance method cannot have null 'this'.
View 16 Replies
Jan 27, 2012
I have an inline lambda expression that I would like to use throughout my application. I just can't seem to find a reference on how to do this with more parameters than the element being tested. Here is a quick example of what I currently have.
Private Sub Test()
Dim List As New List(Of String) From {"Joe", "Ken", "Bob", "John"}
Dim Search As String = "*Jo*"
[Code].....
View 4 Replies
Jun 5, 2012
Is there a way to create a method with unknown number of parameters? And if it this the case: How is it possible to get access to them within this method? Do they have to be from the same type?
View 1 Replies
Apr 6, 2010
I have the following test method (VB.NET)
<RowTest()> _
<Row(1, 2, 3)> _
Public Sub AddMultipleNumbers(ByVal number1 As Integer, ByVal number2 As Integer, ByVal result As Integer)
Dim dvbc As VbClass = New VbClass()
Dim actual As Integer = dvbc.Add(number1, number2)
Assert.That(actual, [Is].SameAs(result))
End Sub
My problem is that when the test runs, using TestDriven.Net, the three method parameters are 0 and not the values I am expecting. I have referenced the NUnit.Framework (v.2.5.3.9345) anf the NUnitExtension.RowTest (v.1.2.3.0).
View 1 Replies
Oct 6, 2009
I was familiar with the optional parameters in vb 6 and it made sense given the capabilities of the language but why the heck does VB.Net support optional parameters when there is method overloading? Which one should I use and is there a difference? If there is a difference when should I use each one?
View 4 Replies
Sep 3, 2009
I have vb.net method and i call it from JS code i can't send parameter to this method and here is sample:[code]
View 5 Replies
Jan 5, 2012
A friend in work suggested the use on classe to store the parameters BEFORE call a method. He's said this is called "Abstract Class". My "know how" of VB.NET is small... so, I want to know of you what mode is the best way: Call a function/sub like that:
[Code]...
View 3 Replies
May 22, 2009
I have a COM component that I want to call using late-binding from VB.NET (using Primary Interop Assembly - PIA method). My IDL signature for the COM method looks like:
HRESULT Send([in]BSTR bstrRequestData,
[out]VARIANT *pvbstrResponseData,
[out]VARIANT *pvnExtCompCode,
[out,retval]int *pnCompletionCode);
So 2 'ByRef' parameters in VB.NET lingo, and a return value. I attempt to invoke this method like so:
Dim parameters(2) As Object
parameters(0) = "data"
parameters(1) = New Object()
parameters(2) = New Object()
Dim p As New ParameterModifier(3)
[Code] .....
This fails spectactularly with an exception: {"Invalid callee. (Exception from HRESULT: 0x80020010 (DISP_E_BADCALLEE))"}
I assume this means I'm doing something wrong in my parameterMods array. Because if I comment out setting any value of the ParameterMods array to 'True' - it works. It of course doesnt update the parameters that are [out] parameters and so it's not working as intended. Is there something else to consider since the method also has a return value? The MSDN example pretty much does exactly what I am doing, with the exception that example did not have a return value.
View 1 Replies
May 8, 2009
I am converting DataTables to a generic list and need a quick and easy way to implement a Find function. It seems I am going to have to use a Predicate. Upon further investigation, I still can't seem to re-create the functionality. Private Function ByKey(ByVal Instance As MyClass) As Boolean Return Instance.Key = "I NEED THIS COMPARISON TO BE DYNAMIC!" End Function
Dim Blah As MyClass = MyList.Find(AddressOf ByKey) But I have no way to pass in a key variable to this predicate to do the comparison, as I used to do with DataTable..Dim MyRow as DataRow = MyTable.Rows.Find(KeyVariable) How can I setup a predicate delegate function in VB.NET to accomplish this?
Do not recommend LINQ or lambdas because this is question is regarding .NET version 2.0.
View 1 Replies