C# - Translation Of Yield Into .NET?
Sep 28, 2010
What is the best/easiest way to "translate" it into VB.NET? Especially i tried to convert this code into VB.NET, but i failed with:
yield return new MatchNode(++index, current.Value);
What i have is:
Imports System.Collections
Imports System.Data.SqlTypes
Imports System.Diagnostics.CodeAnalysis
[code]....
View 5 Replies
ADVERTISEMENT
Sep 29, 2009
Will Visual Basic in Visual Studio 2010 have the YIELD keyword?If not.... Why?
View 1 Replies
Dec 22, 2010
What is the difference in the two blocks of code below? I expected them to return the same result, but they don't.
In the case where xml.@Type = "null", I want PatientMetricTypeID (a nullable Integer) to end up being Nothing.
Block #1: If()
In this case, it ends up as 0. It looks like Nothing is being treated as an Integer and converted to 0. I can sort of see why this might happen but not fully... I would like to understand exactly how this works, and if there is a workaround.
Dim PatientMetricTypeID As Integer? = If(xml.@Type = "null",
Nothing,
CType([Enum].Parse(GetType(PatientMetricTypes), xml.@Type), Integer))
Block #2: If
In this case, it ends up as Nothing -- expected behavior.
Dim PatientMetricTypeID As Integer?
If xml.@Type = "null" Then
[CODE]...
View 3 Replies
Nov 9, 2011
Possible Duplicates: Translation of yield into VB.NETYield In VB.NETI try to convert the C# yield to VB.NET but i found there is no yield in VB.NET
View 1 Replies
Feb 2, 2011
I'm converting some C# code and I'm stuck at this line:c# while (iterator.MoveNext()) yield return iterator.Current;
View 4 Replies
Sep 10, 2009
I have the following code below which has an error. When the checkbox is set to true and for example change the "role", and click save the following error is given;
"Index was outside the bonds of the array".
I know the reason of the error but don't know the solution..
The TxtPayCont is a concatenation of title, fname, and lname in an array. Therefore, if all the fields have values, then it works fine. So if it is Mr Jones Tim, this works, but, if it is Mr Jones it does not. It has to have 2 spaces to work. Is there anyway round this...
(see code below)..
Code:
View 1 Replies
Apr 19, 2011
I have a tricky piece of code in C# that I need translated to VB.NET. That's not usually a problem, as I can do it by hand or using one of the many conversion websites. However, this particular piece of code uses the Yield keyword; and I don't know how to work around that. [Code]
View 10 Replies
Mar 26, 2010
Note that I'm aware of other yield in vb.net questions here on SO. I'm playing around with Caliburn lately. Bunch of great stuff there, including co-routines implementation.
Most of the work I'm doing is C# based, but now I'm also creating an architecture guideline for a VB.NET only shop, based on Rob's small MVVM framework.Everything looks very well except using co-routines from VB. Since VB 10 is used, we can try something like Bill McCarthy's suggestion:
[Code]...
It definitely isn't as elegant as C# version, but it looks to be doable. We'll see if there are any problems with this. If anyone has better idea, I'm all ears.
View 1 Replies
May 17, 2009
In C#, when writing a function that returns an IEnumerble<>, you can use yield return to return a single item of the enumeration and yield break; to signify no remaining items. What is the VB.NET syntax for doing the same thing?
[Code]...
View 6 Replies
Aug 16, 2011
I tried to translate following c# code
public static class ObjectSetExtensions
{
public static void AddObjects<T>(this ObjectSet<T> objectSet, IEnumerable<T> objects)
{
foreach (var item in objects)
{
objectSet.AddObject(item);
[Code]...
View 4 Replies
Dec 21, 2010
Can someone translate me the following code from VB to C#? As far as I understand it is declaration of a function that calls another function from the native library "user32.dll"...Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Integer) As Integer
View 2 Replies
Sep 21, 2009
translate the following code from VB to C#? As far as I understand it is declaration of a function that calls another function from the native library "user32.dll"...
Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Integer) As Integer
View 2 Replies
Jun 17, 2011
[code].....
View 3 Replies
May 15, 2009
I am coding an application in VB.NET that sends sms.Would you please post PYTHON->VB.NET translation of this code and/or guidelines?
[Code]...
View 2 Replies
Jul 14, 2011
I have the following code in VB.NET
<#@ template debug="false" hostspecific="true" language="VB" #>
<#@ assembly name="System" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="System.Xml.Linq" #>
[Code]...
View 1 Replies
Mar 5, 2009
I have a combo box as a dropdownlist box that contains list of states like: IA - Iowa. On form_load, I want the combo box to display a string value that I pass in. However, my string value is a 2-char that represents the state (eg. IA). How can I populate it so that IA - Iowa is selected while my string value is IA. Technically, string "IA - Iowa" does not equal "IA".
[Code]...
View 5 Replies
Mar 31, 2012
It's to open a file by FID. I don't think the object ID will be used...
typedef struct {
DWORD dwSize;
FILE_ID_TYPE Type;
[code]....
View 9 Replies
Apr 11, 2012
I am attempting to find resources of information in regards to the adoption of- and the language translation for VB.NET.Specifically, I need what countries VB.NET was adopted into AND what languages it has been translated to.
View 3 Replies
Dec 23, 2008
I have a problem in translating a piece of C# code
(
http://www.codeproject.com/KB/WPF/VMCommanding.aspx)static bool ConfigureDelayedProcessing(DependencyObject depObj, ICommandSink sink) { bool isDelayed = false;
[code]....
View 7 Replies
Jul 19, 2011
translating this to VB? string sXml = string.Format("<?xml version="1.0" encoding="utf-8" ?><lPartID>{0}</lPartID>", Dts.Variables["PartID"].Value);
View 5 Replies
Mar 11, 2010
I am writing an application in vb.net using a mysql database.I need it to be multilingual.I have not found much useful info on this so I thought I 'd go ahead and work it out myself.I have started making a translation table in the mysql database consisting of the fields id, description, lang1, lang2. I would then use the proper language column according to the configuration. Not too hard upto this point.I was wondering if there is a good reason NOT to use the database, but in stead use plain text files. A good reason would be speed for example.
View 1 Replies
Mar 30, 2011
I found a C# class ActionCommand, that implements ICommand and bases on delegates for Execute and CanExecute.Looks perfect for me so far.
[Code]...
View 3 Replies
Feb 7, 2009
I'm very new to VB 2008, but have been using Access for some time. I would appreciate it if someone could give the VB equivalents of the following:-
[Code]...
View 1 Replies
Jun 25, 2012
I am using a .Net JavaScript implementation called Jurassic to run user-controlled scripts within my .Net 4 WPF application coded in VB.Net - C# answers are fine. The script engine runs on its own thread and provides an API for the script to interact with my application. This all works really nicely until a user executes a script that causes an infinite loop and takes out a core of the processor.
[Code]...
The reason I care about keeping the thread alive is because the user who wrote the script and the user who is running it may not be the same, and I want to keep the experience as smooth as possible the the user running the thread. There also might be legitimate situations in which a single JavaScript function would run for a long time and I do not want to kill that, I just want to stop being allowed to hog the resources.
Solutions that involve stopping the thread from slowing down the system but that still show high CPU usage are not preferable because I do not want the user to wrongly feel that the application is resource intensive.
View 1 Replies
Nov 3, 2011
We are in the process of writing a WCF service using the same pattern as in WSSF. It has its service implementation which makes use of Business logic project to get the resources or save the resources using Data Access Repository. This is where the problem comes since we have to write a translator for translating Data Contract to Business Entity and Vice Versa. This translation is becoming tedious.I am looking for a way (maybe using Reflection) to write one function to Translate Datacontract to Business Entity and vice versa.
View 1 Replies
Jan 27, 2012
Argument not specified for 'userList' of 'Private Sub OpenUserDetail(userList as Model.UserList)'. It works in the C# version just not sure about the C# to VB translation. Original declaration in C#:
private readonly DelegateCommand<EmailDocument> openMessageCommand;
this.openMessageCommand = new DelegateCommand<EmailDocument>(this.OpenMessage);
private void OpenMessage(EmailDocument document) {
// Do stuff
[code]....
View 1 Replies
Mar 11, 2010
i have two textboxes in my form.when i type the text in the first textbox which is english language.now i need to display the the text in telugu language in other textbox.
View 1 Replies
Dec 8, 2009
I have a program in which a user enters a sentence in English into a text box, then the sentence is translated into French and German based on words in an array of structures that gets its values from a text file. I have almost all of the program written, but I am a bit confused on how to get VB to get the English words that are entered into the text box separately so they can be translated individually and the value returned. I need to use a Sub Procedure to get the English Words and to Translate them.
Here is what I have so far.
Code:
Public Class frmTranslate
' Create Structure with a member for each language
Structure Translator
Dim english As String
Dim french As String
[Code] .....
View 10 Replies
Aug 31, 2010
In VB (ASP.NET)
Application("myapp")= Server.CreateObject("APP.Engine")
aa = Application("myapp").myMethod(2)
works.
In C# I tried
Application["myapp"]= Server.CreateObject("APP.Engine")
but
Application["myapp"].myMethod(2)
fails with 'object' does not contain a definition for 'myMethod'How can I expose the public interface in C#?
View 4 Replies
Sep 20, 2010
I have a table in a data grid the columns are bound to the columns...
SQFT QTY WIDTH LENGTH
i also have added into the datagrid an unbound column called Yeild%.what i'm trying to do is the following formula
SQFT / (QTY * (width * length / 144) and have the result return the answer in the unbound yield column for that row represented as a percentage
So if SQFT = 178 QTY = 2 Width = 144 Length = 102 answer would be 0.87 (rounded)
so this would be 87%
View 7 Replies