Translating Delegate Usage From C# To VB
Apr 1, 2010
In physics library written in C# I have the following code:
[Code]...
I'd like to do the same in VB. (just thandling the delegate, not the declaration) I tried this, but it doesn't work: AddHandler ContactManager.PostSolve, AddressOf PostSolve The following works, but only allows me to have one handler for the delegate: ContactManager.PostSolve = new PostSolveDelegate(AddressOf PostSolve) Is there a way for me to do the same thing in VB that was done in the first piece of code?
View 2 Replies
ADVERTISEMENT
Jan 30, 2010
from the documentation we have this: Multicast Delegate: Represents a multicast delegate; that is, a delegate that can have more than one element in its invocation list.
so am i right to say that Multicast delegate is no different from a normal delegate other than the fact that it has arguments. so System.Action is a 'normal' delegate whereas System.Action(T)(Byval obj as T) is a multicast delegate?
View 5 Replies
Feb 9, 2010
I've created a Delegate that I intend to call Async.
[Code]...
View 2 Replies
Jun 1, 2010
Code:
Public Class SendPings
Shared Sub New()
AddHandler Post.Saved, AddressOf Post_Saved[code].....
I get a error" Method 'Private Shared Sub Ping(item As BlogEngine.Core.IPublishable, itemUrl As System.Uri)' does not have a signature compatible with delegate 'Delegate Sub WaitCallback(state As Object)'.
View 4 Replies
Jan 25, 2010
Get the current number of usage days, unique usage days, etc in an evaluation license using CryptoLicensing Generator.
View 1 Replies
Mar 23, 2010
I am trying to write a VB.NET alternative to a C# anonymous function.I wish to call Threading.SynchronizationContext.Current.Send which expects a delegate of type Threading.SendOrPostCallback to be passed to it. The background is here, but because I wish to both pass in a string to MessageBox.Show and also capture the DialogResult I need to define another delegate within. I am struggling with the VB.NET syntax, both from the traditional delegate style, and lambda functions.My go at the traditional syntax is below, but I have gut feeling it should be much simpler than this:
Private Sub CollectMesssageBoxResultFromUserAsDelegate(ByVal messageToShow As String, ByRef wasCanceled As Boolean)
wasCanceled = False
[code].....
View 2 Replies
Oct 15, 2010
I'm trying to write a simple/small Windows Communication Foundation service application in Visual Basic (but I am very novice in VB) and all the good examples I've found on the net are written in C#. So far I've gotten my WCF service application working but now I'm trying to add callback functionality and the program has gotten more complicated. In the C# example code I understand how everything works but I am having trouble translating into VB the portion of code that uses a delegate. Can someone please show the VB equivalent?
Here is the C# code sample I'm using for reference:
[code...]
Is that casting the callback object as type ICommunicationObject? How is that done in VB?
View 3 Replies
Feb 18, 2010
I have to admit, I can't always translate C# code to VB. Case in point:the MSDN library has the definition and example of an FTPWebRequest in C#, but not in VB. I think I can understand most of it, but can someone translate the small snippet below for me? Don't worry about the variable definitions, I've got that, but I can't tell of the subsequent methods are functions or sub routines.And what are those "get" and "set" calls?[code]......
View 6 Replies
Sep 2, 2010
Having trouble converting a bit of C# code to VB.NET.I got his code from CodeProject:
[Code]...
View 1 Replies
Dec 9, 2011
I'm trying to translate some code from VB.Net to C#, but I've run into an issue.The Vb.Net line of code I want to translate is:[code]However, this is giving me a nasty 'Object reference is not set to an instance of an object' error.
View 3 Replies
Mar 25, 2011
I am more of a PHP Coder then VB.net Programmer so I made this and converting this function.
<?php
function grabshade($r,$g,$b){
$colors = array(array(0, 0, 0), array(255, 255, 255));
$differencearray = array();
[code]....
View 3 Replies
Jul 31, 2011
I'm not the best at reading and translating C#.
public IEnumerable ActiveEntities
{
get { return GetActiveEntities(Query); }
[Code].....
View 4 Replies
Jan 16, 2011
what I am trying to do it read a form of hex that is encoded I know the cypher what I want to do is make a program for myself that will let me compare 2 files. Both in hex decypher the hex to numerical.I call the hex backwards hex what I mean is this..in stead of "04 58 d2 d2" it is "d2 d2 58 04" I know the number it translates to is 72930002I want to show the entire list in a list box where I can choose wich I want to look at.
View 8 Replies
Jan 25, 2011
MVC 3 is great but in some cases I am having trouble translating the Razor syntax. Anyone know of a good VB.Net Razor reference?
View 1 Replies
Aug 6, 2009
I am translating a piece of C# code into VB.NET using online convertors..[code]The VB.NET translation is not up to the mark and gives compiler errors Any VB.NET expert who can suggest what to change to make the code compile?url.
View 10 Replies
Oct 18, 2010
I recently asked a question about translating a code sample I found on on the internet from C# into VB and I was given links to websites that automate code translation [URL].. I am very new to VB and unfortunately the VB that the translators returned doesn't compile in Visual Studio 2010. I am hoping someone can help me fix the non-working portion of VB code.
Here is the C# code I am converting into VB:
[Code]...
View 2 Replies
May 9, 2011
with translating some code from VB to C#.
Public Function ToBase36(ByVal IBase36 As Double) As String
Dim Base36() As String = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
[code].....
View 3 Replies
Aug 18, 2011
I am writing a program in visual studio to exchange data with a webservice. The webservice, Kareo.com, gives an example of a program but it is in C# - I am trying to replicate their program in visual basic, which is the language that I am more comfortable with. I got most of it to work but am running into problems with two lines "patientCase.Policies = new InsurancePolicyCreateReq[] { primaryPolicy, secondaryPolicy };" and "newPatient.Cases = new PatientCaseCreateReq[] { patientCase };"the C# version of the entire program is below.
[Code]...
View 2 Replies
Apr 16, 2012
Just a quick question, what will this code be in vb.net? if this is the wrong place for this request.
[Code]...
View 1 Replies
May 19, 2011
I have this piece of VBNet code that i would like to translate into javascript:
Dim phone_check_pattern = "^(+?|((+?[0-9]{1,3}))|)([ 0-9.//-]|([ 0-9.//-]+))+((x|X|((e|E)(x|X)(t|T)))([ 0-9.//-]|([ 0-9.//-]+)))?$"
System.Diagnostics.Debug.WriteLine(System.Text.RegularExpressions.Regex.IsMatch("test input", phone_check_pattern))
my translated result:
var phone_check_pattern = "^(+?|((+?[0-9]{1,3}))|)([ 0-9.//-]|([ 0-9.//-]+))+((x|X|((e|E)(x|X)(t|T)))([ 0-9.//-]|([ 0-9.//-]+)))?$";
alert(new RegExp(phone_check_pattern).test("test input"))
However when i run it it has error Uncaught SyntaxError: Invalid regular expression:: Nothing to repeat
(my VbNet code doesn't have any error though)
View 3 Replies
Jun 9, 2011
i'm starting to learn vb.net, and i trying to make some special translating program, its need to translate hebrew text into special letter sequence. the text input are: ב יית בי יי ים מתקדמים (which its means Construction of advanced buildings ) And the text output are: BPJJZ_BJPJJPJM_NZWDNJM according to the list i made (Attached picture).
[Code]...
View 17 Replies
Nov 4, 2010
I want my code to look at a textbox to determine which letter is in it, & assign a numerical value to a second textbox, based on what letter is in the first textbox.[code]The problem is that, when I step through the code, I can see that Form20.txtGrade1.text DOES EQUAL "C", but my code skips over the part that says Form20.txtGrade1a.text = "4". Instead, if I hover over that part, I can read Form20.txtGrade1a.text = " ".When I do not step through the code, and just run it, I see the two textboxes, with the first one containing the C, and the second one is just blank.
View 4 Replies
Feb 25, 2009
In my current project, i need to build a tool to translate text from some languages to English
Ex.: Chinese To English
Is there any translation SDK available?
View 3 Replies
Feb 19, 2012
I have almost completed a translation from C# to VB.NET, however, I run into some small errors[code]...
View 1 Replies
Oct 17, 2011
translating form data (fetched from mysql) to excel doc how can i do it? i saw a couple of examples but none worked only in vb6?
View 3 Replies
May 6, 2011
I was wondering if someone could translate this code into a more understandable code. It is suppose to be a function that accepts an item name its cost and its quantity. and adds one more array element to ."items" variable and assigns the given name and cost and quantity.
Public Sub AddItem(ByVal strName As String, ByVal dblCost As Double, ByVal intQuantity As Integer)
Me.items=DirectCast(Utils.CopyArray(DirectCast(Me.items,Array),New Purchase(me.itemsCount + 1)-1){}),Purchase())
End Sub
This is the translation i made but i don't think it is correct.
Public Sub AddItem(ByVal strName As String, ByVal dblPrice As Double, ByVal intQuan As Integer)
Dim items As Purchase() = Me.items
Dim itemCount As Integer = Me.itemsCount
For itemCount = 0 To items.Length - 1
[CODE]...
View 3 Replies
Oct 20, 2009
I am trying to mimic the results of some C code that uses the OpenSSL library using the system.security.crytography library in the .net 3.5 world, and I can't seem to get it right. part of the issue is my understanding of crytography in general.
Here's what is supposed to happen:
I send a request for authentication to a device.It returns a challenge digest, which I then need to sign with a known key and return The device returns a "success" or "Fail" message.I have the following code snippet that I am trying to "copy":
[Code]...
View 4 Replies
Apr 22, 2009
While reading this threadthe code sample there came from MSDN, which was used to demonstrate the use of a delegate. I know what Delegates are. And I know how they work when it comes to things like crossing threads and even sinks.... how ever, the sample given is a simplecontrived example, and I'm wondering why/when would I use a delegate in this situation? Or in any situation? In my head, it seems it would have been easier/cleaner to call the function pointed to directly...
View 18 Replies
Apr 28, 2009
How do I get the cpu usage percentage to display in the label on a form?
View 4 Replies
Feb 11, 2010
I heard once that .net introduced an already defined delegate with no parameter that we could use instead of creating one.
View 1 Replies