I have a method called ADD in a class that connects to a database. The database class name is XDB. I also have an object named XXX in it's own separate class with properties.One of the instructions for the Button named ADD click event is:
'Call Add method passing in the XXX object
So this is how I coded:
'declare a variable X as an object instance of XXX
Dim X As New XXX[code].....
I know it's wrong since it doesn't add the XXX and the form doesn't close but I don't know what I'm doing wrong.
I have the following generic method : Namespace Helpers
[Code]...
I would like to use type interference so that when i call ToGenericType method, I would not need to pass the type(t) This is how i call ToGenericType now.......
Is it possible to pass multiple arguments to a delegate method from a list(Of T).ForEach call?So, I'd like to pass a listbox object to the delegate routine below:
Sub test() Dim names As New List(Of String) names.Add("Bruce") names.Add("Alfred")
may I just ask a seemingly simple question for which I can't find any solution throughout all the VB.NET documentation: I have to call a (non-static) method of another object (instance!) based upon the name of the method (given as a string).
I'm currently working on being able to import a DLL written in Fortran into Visual Basic. I've got all the basics down, so now I'm trying to take it a step further. The title basically says it all, but I'll explain what it is I'm trying to do anyways.
For kicks and giggles, let's just assume I want to pass an object that has three double values in it, possibly representing a point in space in three dimensions. In my Fortran method, I want to take that object, print out the x value, then change the x value to 7.5. Here's my Fortran code that does just that.[code]...
I have some files in vb.net that have "Option Strict Off" to allow for bad programming. When I convert to c# I use "dynamic" until I come back and fix problems, and this works in all cases But now I have this code:
Public Class ContractResults 'Big class definition Public Shared Sub CleanCache()
[code].....
And in a file with Option Strict Off:
Public Sub VerifyResults(result as Object) 'Here, result is normally ContractResults 'first it check for that then call this: result.CleanCache() End Sub
In c# I use "dynamic", but a runtime error pops up when I call "static" method with dynamic reference. In vb.net, I can called "shared" sub from instance, but in c# this is not allowed
Exception: "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException" "Member 'ContractTypes.ContractResults.CleanCache()' cannot be accessed with an instance reference; qualify it with a type name instead"
It seems I must convert code to use actual type, but then this means much rewriting of more parts. Is anyone able to show another way?I want to make sure you do not think I can use (result as ContractResults).CleanCache();Because all types that may be passed in have "CleanCache()" method, but do not inherits from anything the same other than "Object". There are many types (30!) that have this "static" method and so that is why it uses Option Strict Off?
I wrote a page Page method in my aspx page. in web service method I need to call FindControl method return textbox and get text box value. But my findControl will take MasterPage object to iterate.
see my code
<script type = "text/javascript"> function ShowCurrentDateTime() { $.ajax({
[Code]....
How to pass Master Page object or Page to Page method?. So I can use in Sared method.
Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.
I have a Application that Crypts all Files in a Directory and the Subdirectories
Public Shared Sub CryptAllFiles(ByVal crypt As Object) 'check if this dir exists Dim vDirInfo As New DirectoryInfo(vPath) If Not vDirInfo.Exists Then Exit Sub 'get all files' sizes in current path
Is there a way to choose between different methods and pass one into another method ?
Sub conditionnal_binding(ByVal list_box_reference As ListBox, ByVal list_box_final As ListBox, _ ByVal dico_source As Dictionary(Of String, List(Of String)), _ ByVal my_methode As ??? ) ' DO SOMETHING End Sub
I wrote ??? because I don't know how to call another method inside a method. I would like to choose between different "sub-methods". Here is how I would like to use my method :
I am working on a application that has quite a few functions involved and have been thinking of the following: If I have a function that has a few paramaters, is it more efficient to pass the objects to the function(Example 1) or reference the objects in the parent(Example 2)? Does it matter if the objects are large or not?
Example:
Class mainform Public myGenericList As New List(Of String) Public myDatarowArray() As DataRow
i want to which way is better when concentration is on processing speed. i want to call a method that compute some data that method is on another form in my windows form application then what you prefer is better way 1) to call that method in another form and use returned value or create similar method in form where it is required.i want to make it's processing fast.
Im trying to call a procedure to run into a thread..But this procedure requires two arguments. How can I pass these arguments in to the function when the thread call:
Dim myThread As New Threading.Thread(New Threading.ThreadStart(AddressOf PopulateTermList myThread.Start()
addressof PopulateTermList should only be called without parenthesis(the VB tells me this)
I have a 3 functions that should be called in order, that I want to do this in a thread say about 20 for each argument I pass. So for example
sub process_work(arg) result1= function1( arg ) result2= function2(result1 ) result3= function3( result2 ) listview.items.add( result3 ) end sub
How do I call this sub and pass to thread on button click. Is it possible to spawn new thread it I pass argument to this sub and the current or last one is busy?
I am getting following error whenever I want to use IIf function inside entity framework query.
LINQ to Entities does not recognize the method 'System.Object IIf(Boolean, System.Object, System.Object)' method, and this method cannot be translated into a store expression.
I have some functions written in C that read & write large binary files (> 4 GB) using routines CreateFile, ReadFile, WriteFile & SetFilePointer, that use the HANDLE data type to access the file. Some others who are more familiar with Visual Basic would would like to be able to call my C routines to work with such large binary files. We particularly need SetFilePointer to jump around with the files.
I have a class that runs as a thread. While the thread is running, I want to call a method in that thread. I do this commonly where a thread calls a method in the GUI with a delegate. But I'm confused how to do this when the called thread is not the GUI and there are no parameters passed to the called method.
In VB .NET, when you create a user control class, you have the obligation to call the sub InitializeComponent within the constructor.If you don't you'll a warning message like this: [code]What is the mechanism used to raise this warning? Is it something I can reproduce for my own functions?
i have a problem i use a call sub procedure to do a delete records in my database for my vb .. now i have a problem when i call my sub delete proceudre in like this call GetDelete("tblName") , but in the sql query the sysem declare like this delete * from 'tblName' in my sub procedure when i set the breakpoint in which cause an exception error "Syntax error in query. incomplete query clause " anyway how to delete the quotes so i can retreive it without error
When should I call the Flush() method (TextWriter.Flush() / StreamWriter.Flush() / BinaryWriter.Flush() / etc) ? Should I call it everytime I finish writing a stream?
I'm trying to code a class of RandomNumber. One of the class methods needs to populate a "List (Of RandomNumber)" ... which was passed as a parameter to the method ... with 10 random numbers between 1 and 50. DEAD SIMPLE :)