Possible To Have An Argument Of Any Type?
Sep 6, 2010Is it possible to have an argument of any type? Here's what i mean:[code]
View 3 RepliesIs it possible to have an argument of any type? Here's what i mean:[code]
View 3 RepliesI made this procedure re-use a select query:
[code..]
And I use it like this if I would want the selected value placed in a textbox and it works fine
[code...]
However if I want the value to be passed in a string like so:
[code...]
The string ends up having an empty string value. How do I assign the value I queried to that String?
I've spent quite a bit of time reading up on generics, covariance, etc., and I am failing to understand why I get the aforementioned compiler error in this type of codeLet's say I have a base "Bill" class made up of a collection of Lines..
Public Class Bill(Of L As Line)
Private _lines As List(Of L)
Public Property Lines() As List(Of L)
[code].....
I have the below lines of code :I am getting the error as mentioned in the Title above.This error has come after converting a C# Code to VB.NET Code which is mentioned below:
C#:
public override IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingContext context)
{
if (context == null)
[code]....
I have the following two tables defined...
CREATE TABLE [LogLevel] (
[Id] int primary key
,[Name] nvarchar(50) not null
[code]....
After creating a fresh endity model, I add the two tables above. When I try to build I get the following errors...
Type argument 'Inxsol.CommandPlan.Data.Model.Log.LogLevel' does not satisfy the 'Class' constraint for type parameter 'TEntity'.
Value of type 'System.Data.Objects.DataClasses.EntityReference(Of Inxsol.CommandPlan.Data.Model.LogLevel)' cannot be converted to 'System.Data.Objects.DataClasses.EntityReference(Of Inxsol.CommandPlan.Data.Model.Log.LogLevel)'.
[code]....
I'm using VB.NET 2003 with .NET Framework v1.1. I know it's getting a bit old now but I'm stuck with an existing program and don't have the time/knowhow to convert it to anything newer.
My question would probably be solved very easily with Generics in .NET 2.0 but as I can't use that right now, I'd like to know if the following is possible:
I have a load of manager classes which inherit from DictionaryBase and hold collections of my custom classes. For example, I have a Employee class, a Batch class, a Supplier class, etc... and each of these has a Manager classwhich holds a collection of them - eg: my PlantTrayMgr class holds collections of PlantTrays, etc..
I have one particular form where I have to populate loads of comboboxes with the contents of various Manager objects. What I currently do in my form load event to populate comboboxes is this:
Code:
Option Strict On
Option Explicit On
Private _plantTrayMgr As PlantTrayMgr
[Code].....
Why when I press button without enter the data to one of the field I got:
Argument 'Date1' cannot be converted to type 'Date'.[code]...
How can I create a function that returns an object of a certain type, which the user of the function specify in the argument (using vb.net 2010) ?
[Code]...
The code above doesn't work, but maybe it can explain what I want to achieve. Using this feature, I want to hydrate my data transfer objects from datatable. Client will just call this function, specifying which DTO the client wants, and this function will just create that DTO and populating the properties with reflection GetType.GetProperties().
How would that work? I can't find any documentation in the MSDN.you know how when you open a txt file it opens up notepad and loads the file? how does the whole 'loading the file' thing work in VB?
View 1 RepliesI got 2 classes in a form, and I would like to pass a value from a textbox to the other class, so I decided to use Deligate.
Below is the code.
Public Delegate Sub delPassSize(ByVal text As TextBox)
'To get size from Class Calculate(Class 2)
Public Sub GetSize(ByVal txtForm1 As TextBox)
[code]....
and the error message is 'cls.Getsize is a delegate type and requires a single 'addressof' expression as the only argument to the constructor.'
i have 2 mustinherit classes where one is a generic one:
'Visual Basic 2008 - .net 3.5 - Any CPU
Public MustInherit Class BaseObject
End Class
Public MustInherit Class BaseObjectList(Of T As {New, BaseObject})
Inherits List(Of T)
End Class[code]...........
i receive: "Type argument BaseObject is declared 'MustInherit' and does not satisfy the 'New' constraint for the type parameter"users would never enter data in the wrong form,files they choose to open would always exist and code would never have bugs.
As you noticed, in the code bellow, the event argument for the form click event has the type "TimedEventArgument".When the event is raised, e.Time holds the time where the form was clicked.Add the missing code in the class Form1 to make this work.You will not change anything to the methods "Form1_Click" or "Form1.Load".You will not use Option Strict On. HOWEVER, you will not do any narrowing or late binding that wouldn't have been allowed if Option Strict was on.You cannot create any new Class, Structure or Module.You cannot cast the EventArgs to TimedEventArg in any way
[code]...
I want to do something like the following in VB.NET, is it possible?
Function task(value as Object, toType as Type)
Return DirectCast(value, toType)
End Function
FORTRAN allows one to use a procedure (function or subroutine) as an argument to another procedure. For example:
SUB Procedure1(x)
----
----
RETURN
[code]....
Does Visual Basic 2010 allow this functionality, directly or indirectly?
I have a sub declared inside a module which accepts form as argument.
sub display(fname as form)
What I need is to call the sub form the load event of a form.I tried the following.
display(me)
But cant access the controls of the form inside the sub.
sub display(fname as form)
fname. 'no controls of the form are listed?????????????
end sub
Hi. The assignment reads code the application using an idependent sub procedure to both calculate the display the bonus amount. Also use a sub procedure to clear the contents of the bous label when the text change event occurs. In addition code each texts box enter event procedure. When I call the calcbonus, it says argument is not specified for the parameter.
' Project name: Bonus Calculator Project
' Project purpose: Calculate a 10% bonus
' Created/revised by: Jessica Falcetta on 11/07/09
[code]....
error BC30455: Argument not specified for parameter 'pTools' of 'Public FunctionfragPacket(ByRef pTools As Object) As Integer'.!I get this code while trying to get something to work.. heres the code
if (pName.Length >= 13) andalso (pName.SubString(0,13) = "actor_display") then
dim aid as Integer = pTools.FourByteToNum(pBytes,2)
if (aid <= 4000000) and (aid <> ownAID) then
[code].....
Argument Not Specified For Parameter. [code]...
the error show to me in this line (( Adddata(TextBox1.Text, TextBox2.Text.ToString, TextBox3.Text.ToString, TextBox4.Text.ToString, TextBox5.Text.ToString) ))
I am currently working on a sample Invoice application. I have created a product class with a constructor and various methods and properties. In my form class I have added dim statements to create variables to hold my product objects and other various objects I have created.[code]....
View 4 RepliesA fast-food vendor sells pizza slices ($1.75), fries ($2.00), and soft drinks ($1.25).Write a program to compute a customer�s bill.The program should request the quantity of each item ordered in a Sub procedure, calculate the total cost with a Function procedure, and use a Sub procedure to display an itemized bill. A sample output is shown in Fig. 5.26.Coded it out but when I try to break it down to separate functions I keep getting:
Error1Argument not specified for parameter 'CalculateFries' of 'Public Function CalculateTotal(CalculatePizza As Double, CalculateFries As Double, CalculateSoft As Double) As Double'.
Error1Argument not specified for parameter 'CalculatePizza' of 'Public Function CalculateTotal(CalculatePizza As Double, CalculateFries As Double, CalculateSoft As Double) As Double'.
[code].....
Here is the problem I'm working on.A fast-food vendor sells pizza slices ($1.75), fries ($2.00), and soft drinks ($1.25).Write a program to compute a customer�s bill. The program should request the quantity of each item ordered in a Sub procedure, calculate the total cost with a Function procedure, and use a Sub procedure to display an itemized bill. A sample output is shown in Fig. 5.26.Coded it out but when I try to break it down to separate functions I keep getting:
Error1Argument not specified for parameter 'CalculateFries' of 'Public Function CalculateTotal(CalculatePizza As Double, CalculateFries As Double, CalculateSoft As Double) As Double'.
[code]....
In VB.NET, can we pass an original object as an argument without instantiating it? For example, I have two forms in my project formA and formB. Now I have this code.
[Code]...
Apart from this, in VB.NET in any class like formA, if I type formA, I can see all the objects and controls present there but not in C#. Again, I have to make a new instance to see all the controls. This becomes a problem if I want to manipulate two running and working instances with each other. So what basic thing am I missing here?(I am an amateur programmer migrating from VB.NET to C#. Things are going nice and clean expect for the ones I've recently figured out.)
[URL]It is a sub that is meant to add a user to a group in Active Directory. However, I can't seem to figure out how to use it. Here is the code:
''' <summary>
''' Method to add a user to a group
''' </summary>
''' <param name="de">DirectoryEntry to use</param>
[code]....
I'm not sure what to put for the first argument when calling it. For example:
AddUserToGroup(?, User, Group)
Got a strange one and I know it is something silly but I can't see it for anything I have a DLL created in VB.net (No I can't change it! :-)) and am calling it from C#. The problems come at the point the object is created in C# and I get the message that it has "some invalid arguments".
The constructor code in the DLL is as follows:
Sub New(ByRef Connection As IConnection)
The code in C# is:
IConnection conn = new Connection();
CustomObject test = new CustomObject(conn)
It is happy with the first line but it gives the error message ("some invalid arguments") on the second line. I have also created a secondary project in VB.net and called the DLL and it works fine there.
I have migrated my app from VB6 through Visual Studio 2008 to VS 2010. I have corrected all flagged errors, but I have not made any changes to code otherwise. Now I am getting Error #5 under some circumstances, and the text of the message is as follows:Argument 'Start' is not a valid value.I have done a global find for 'Start' throughout my Solution, but got no hits within my Basic code. Where is this error originating?Why has the pasting of the error text above changed my post's font?
View 11 RepliesWhen I place Set_Symbol() in my code it give me 2 errors
Errors:
Argument not specified for parameter 'e' of 'Private Sub Set_Symbol(sender As Object, e As System.EventArgs)'. d:documentsvisual studio 2010ProjectsMath GameMath Gamefrmindex.vb
Argument not specified for parameter 'sender' of 'Private Sub Set_Symbol(sender As Object, e As System.EventArgs)'. d:documentsvisual studio 2010ProjectsMath GameMath Gamefrmindex.vb
This is what Set_Symbol is
Private Sub Set_Symbol(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles rbnaddition.Click, rbnsubtraction.Click, rbnmultiplication.Click, rbndivision.Click
Dim rbn As RadioButton
[code]....
Why is it throwing this error?
I have :
Dim con As New OleDbConnection(My.Resources.ConnectionString)
// Give exception = Format of the initialization string does not conform to specification starting at index 62.
When I substitute the actual value of the Resource, it give no exception :
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:
awData.xlsx;Extended Properties=""Excel 12.0 XML;""")
The value of ConnectionString in Resources :
<data name="ConnectionString" xml:space="preserve">
<value>Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:
awData.xlsx;Extended Properties=""Excel 12.0 XML;""</value>
</data>
I don't understand why is this happening ?
I think this should have been replaced even before the compilation process..
Then why is it giving exception ?
Argument not specified for parameter 'AppointedTime' of 'Public Overridable Overloads Function Insert(CustomerID As Integer?, LoanOfficerID As Integer?, _Date As Date?,AppointedTime As String) As Intcan any 1 explain what is the issue with this an me having a text box to enter time??i am making a form to add a new record in here;s my code
Form1.APPOINTMENTTableAdapter.Insert(Me.TextBox1.Text, Me.TextBox2.Text, Me.TextBox3.Text)
Form1.APPOINTMENTTableAdapter.Fill(Form1.A_AAADataSet.APPOINTMENT)
MsgBox("Record ADDED successfully!!!")
[code].....
I have a problem with my loop perhaps my index.I want to loop throgh list box items one after the other picking EmployeeID,GroupName,PeriodID respectively after which i insert into a table.I have written this codes but it is giving me an Arugument out of range exeception indicating.You could see that Even if I terminate the loop at i-1, or start k from 1 and end at i, still i gives me the error.[code...]
View 3 RepliesI have a form that loads in my project and does some task on its own, then closes itself. I'm implementing a new functionality into the program where I need to call this form with an argument (to later be used as a conditional clause). If I call the form from a certain button, I want to launch the new form with an argument ("automatedTicket") and I will then use this argument as a conditional test in the code of the form.where, in the ACCEPTING form do I put the argument declaration?
basically i need to do something like:
ServiceTicket.Show(False) 'false for being a manual ticket (click of button)
ServiceTicket.Show(True) 'true for being automated (no user intervention)
then in the ServiceTicket form, where do I put that I'm expecting one argument? and where do I declare that argument name (automatedTicket)?