Converting C# Program To VB - Use "Yield" Statement ?
Feb 23, 2012
I am converting C# program to VB. I heard that "Yield" statement is ready from Visual Studio 2010 SP1.
[URL]
I updated my developing environment to Visual Studio 2010 SP1. However IDE still displays error to the following code saying that "yield" is not delclared.
Public Class WeakCollection(Of T)
Implements IEnumerable(Of T)...
ReadOnly innerList As List(Of WeakReference) = New List(Of WeakReference)()
[CODE]...
How can I use "Yield" statement in VB?
View 3 Replies
ADVERTISEMENT
Sep 29, 2009
Will Visual Basic in Visual Studio 2010 have the YIELD keyword?If not.... Why?
View 1 Replies
Sep 6, 2011
I have this piece of code which is calling some functions in a web service. however the original was written in VB and when I have converted it it gives me an error in my c# stating that 'The name Information does not exist in the current context' I have checked the VB and it win there either!
[Code]...
View 4 Replies
Dec 4, 2010
Can some one convert this statement from c# to VB.net for me?
double pressure = (int)(((usbRecord[8]) & (byte)(0x0f)) << 8) + (int)(usbRecord[7]);
View 2 Replies
Aug 9, 2011
In a vb script program, I have the following code objCommand.Properties("Page Size") = 9999..I have converted most of the vb code over, but this statement gives me a "Property Item is ReadOnly" error. How can I rewrite this line to work in vb.net?
View 2 Replies
Mar 29, 2010
i have to convert a visual basic 6 program to the visual basic 2008. i used the wizard that is provided to upgrade but that just doesn't work. It comes up with many errors. most of them are End of statement expected and Number of indexes exceeds the number of dimensions of the indexed array. I really don't know what to do with them and i have to fix them in order for it to run.
View 18 Replies
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
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
Apr 13, 2010
converting a VB.NET handles statement to C#. This is the VB
View 3 Replies
Jul 20, 2011
I have been given the task of converting an old program from Vb 5 that needs to be able to run in VB2010. I have read a few forums on the subject but whatever I try doesn't work. The .bas files convert over fine and the code from the forms comes over, but the forms do not appear. Instead there is a bunch of gibberish. How can I convert this? I tried going to version 6, which the forms worked in, and then to 2010, but I couldn't get the vbp file to show up or the forms.
View 1 Replies
Apr 10, 2012
I converted a lot of code, and I had some errors in the conversion. There is one that I can't seem to figure it out[code]...
View 2 Replies
Mar 7, 2010
I am trying to a create a program that converts a Fahrenheit temperature to a Celsius temperature and vise versa. My form consists of three command buttons(Compute, clear, quit), two radiobuttons where you choose whether you want the entered temperatures to be converted from fahrenheit to celsius or celsius to fahrenheit, three text boxes(start value, stop value, increment), and a list box that displays the information. My problem is that the program needs to limit the conversions to 20 per computation. The program must verify that the range of values and increment will not generate more than 20 lines before any calculations are performed. I need a way to check whether more than 20 lines will be put into the list box before anything is actually put into the list box.
My current code is below.
CODE:
View 3 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
Jun 15, 2010
visual basic 2010 after converting a program from visual basic 2008 is stating that the Shell function is a namespace and cannot be used as an expression. this can be fixed with the create sub feature but when debugging causes an error stating that there is a nohandled exception.
View 5 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
Dec 14, 2010
I am trying to make an If statement. I have 4 radio buttons
Part Time
Full Time
Part Time Temp
Full Time Temp.
I am calculating Fringe and Calucalted Funds.I also have 6 constants
Const PEIABasic_RATE_Decimal As Decimal = 5.06
Const PEIAFAMILY_RATE_Decimal As Decimal = 778.0
Const WORKERSCOMP_RATE_Decimal As Decimal = 0.0049D
[code]....
I have two text boxes where a user can enter the hours worked and hourly rate. and Salary rate. If a user clicks the Full time radio button the calculation for fringe should be FICA const * salary Works comp const * salary.Then u would add the fringe to the base salary. Part time the user needs to click the part time button along with another button, either TIAA or State REtierement.
If FullTimeTempButton.Checked & TIAARadioButton.Checked Then
FringeTextBox.Text = (FICA_RATE_Decimal * SalaryTextBox.Text) + (WORKERSCOMP_RATE_Decimal * SalaryTextBox.Text) + (TIAA_RATE_Decimal * SalaryTextBox.Text)
[code]....
View 12 Replies
Jul 10, 2010
I have made a smtp client in c# and I use this code to split a string that contains multiple recipients.
foreach (var n in txtSendTo.Text.Split(';'))
{
mail.To.Add(n);
[code].....
View 3 Replies
Jun 25, 2010
Is there any available tool for converting variable and loops declarations from VB.NET to C++?
View 3 Replies
Apr 11, 2012
I'm not quite sure why, but this program doesnt work as intended. It's kind of difficult to explain but if you tried it, it doesn't work properly.
Private Sub btnApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApply.Click
'clears the changes box before going through if statements
Me.txtChange.Text = ""
[CODE]...
View 3 Replies
Oct 1, 2010
I want to insert a record using SQL and one of the fields needs to contain a carriage return, [code]...
View 2 Replies
Apr 21, 2012
I have this sql statement to update a column in access db from vb but when I run the program it shows that there is a syntax error in the statement. [code]...
View 2 Replies
Feb 17, 2009
i am using vb/vb.net and the database is visual foxpro 6.0 then i want to create the tables from the application using sql statement.i need to add the number field into the table. i can not add the number field in the tableres.open "CREATE TABLE Customer ( CustName char(50), CustId int(2))",conXavier
View 2 Replies
Nov 9, 2011
Can i insert in two tables data with one insert statement in .net VB 2008?
View 1 Replies
Jul 15, 2010
Is there a way to make a VB case statement evaluate all the cases? Similar to a java switch statement (without the break).
View 5 Replies