C# - Way To Implement Caliburn-like Co-routines In Since There's No Yield Keyword?

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


ADVERTISEMENT

Does VB In Visual Studio 2010 Include The YIELD Keyword (yield Return, Yield Break)

Sep 29, 2009

Will Visual Basic in Visual Studio 2010 have the YIELD keyword?If not.... Why?

View 1 Replies

How To Convert C# Keyword Yield

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

VS 2010 - Alternative To YIELD Keyword In VB

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

Implement Yield Return For IEnumerable Functions?

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

VB 2008 - How To Implement The Keyword, Me

Dec 16, 2009

I am working in vb2008. how to implement the keyword, Me. I see it used in code examples but when I try it, it does not work.

View 3 Replies

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

.net - Identical If() And If Yield Different Results

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

VS 2010 C# Yield Return In VB?

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

Null String Yield An Error

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

Can Sub Routines Be Placed Into Classes For Later Use

Feb 6, 2011

I have a slew of sub routines that I need to use in my software because each website that I will be accessing don't all use the same methods.....go here...click that...go here...click that...etc etc

So I've divided them into sub routines and call them when I need them but the coding is getting so long that it's becoming confusing to keep up with each sub.

Is it possible to place the sub routines into an independent file like a class and then call them from the file when I need them so I can free up some space to code?

View 1 Replies

Routines With The Same Name But Different Arguments

Oct 15, 2010

I am listing the following three subrointines....

Private Sub OutPut(ByVal Offset As Long, ByRef path As String) 'Orig
If Not cbFiles.Checked Then
item1 = New ListViewItem(Offset)

[Code]....

They have the same name but a) different types of aguments or different numbers of arguments. This is legal in VB.

View 1 Replies

Detrmine The Time Taken For Various Routines?

May 3, 2010

VB 2010 express Win XP pro I'm tryimg to detrmine the time taken for various routines, and not having much luck.From what I can gather, it seems that short times and very long times are a problem, as is my understanding of what I have read. cpu speed shown is correct.I checked a few routines, very short routines return 0, to be expected, ?resolution.Longish times (about 33 seconds with a stopwatch), report to be 177 seconds.

[Code]...

View 9 Replies

Link Routines To Combo Box Selectedindex

Jun 11, 2009

I'm trying to have it so that when the user selects an item from the combo box, it will display the right nodes for that selection in the treeview control. For example: User selects Artist from the combo box and the treeview displays the letter of the artist. The user selects a letter and it will display all artist with last names beginning with that letter. Unfortunately when I select a selectedindex, the treeview doesn't display anyting, it's blank. What am I doing wrong? Here's the code I'm using for artists:

[Code]...

View 1 Replies

Asp.net - Moving Common Routines To The App_Code Class?

Jan 22, 2010

I have some common code that I would like to share between pages and I have been messing around with App_Code classes which is great but I would also like to use code that affects drop down lists example:

Sub Set_FirmType(ByVal Sender As Object, ByVal E As EventArgs)
subcategories.Visible = "false"
supplycategories.Visible = "false"

[code]....

Is their a way to put this in my App_Code class?

View 1 Replies

Call Fortran Routines (LAPACK) From Program?

Jan 27, 2009

I have LaPack numerical package , I want to compile with Visual Fortran (INTEL) using vs2008.I want to use the routines from a VB.NET program.How can I call the routines from VB ?

View 9 Replies

Threading - Baton Object That Routines Can Pass Around?

Feb 20, 2011

This will no doubt sound like a pretty dumb question to some, but, despite having written many useful single-thread apps over the years, I don't understand enough about threading yet.

Consider this scenario:

There are four modules, each on its own thread, that can happily run concurrently most of the time. However, each module occasionally causes a few seconds' intensive disk activity (by design) and it would be more efficient (faster, less fragmentation) if only one module at a time wrote to the same physical drive.

It would be useful to have something like a baton that modules within a given scope can pass around, perhaps dependent on their respective priority levels.

View 2 Replies

Using PInvoke To Access Some Routines From A Third Party Library?

Sep 9, 2009

I'm using PInvoke to access some routines from a third party library, however i'm getting SEHExceptions when trying to use callbacks defined for one particular method. The callbacks are used to provide feedback from other unmanaged methods within the third party library, passing a string back to the calling application containing a status message.

[Code]...

View 18 Replies

Write XML Document To Group Information From Two Different Sub Routines

Jan 19, 2012

I am trying to retrieve all processes running on a machine with the usual information; process id, name and the memory usage. I am trying to export it all under one xml file, however to get all the information I had to use 2 separate methods. To get the process id, name and session id (process owner) I used the following code along with a dictionary and a class, using a .net library called Cassia.

Using server As ITerminalServer = manager.GetRemoteServer("Spartacus")
server.Open()
For Each process As ITerminalServicesProcess In server.GetProcesses()
If Not String.IsNullOrEmpty(process.ProcessId) Then
dictprocess.Add(process.ProcessId, New Processes(process.ProcessId, process.ProcessName, process.SessionId))
[Code] .....

As you can see the unique id (process id) is the same in each xml. Is there any way I can write the xml so that the information from both methods can be under one tag?

View 1 Replies

Forms :: .net Windows App To Perform Routines At Regular Intervals?

Jul 11, 2010

i have a need for my vb.net app to perform methods at regular intervals. it needs to check sql tables and react to data found, send email and sms messages. i've tried using a loop but this only allows me to perform 1 check ie checking sql tables. the app needs to execute a method every x minutes. i tried using system threading but i got errors.

View 1 Replies

How To Hook Up Keypress Events For Cut / Copy And Paste Routines

Nov 5, 2009

I have a Windows Forms app, with a TabControl. On the first tab (which is a bunch of textboxes), the CTRL-x/c/v keyboard shortcuts for cut/copy/paste work as expected. On the second tab (which is a DataGridView), the keyboard shortcuts don't do anything. How do I hook up these keypress events to my cut/copy/paste routines? I already have great cut/copy/paste routines for my DataGridView--and they work fine when launched from the tooltip buttons or menus. I just need to hook up those subs to the CTRL-x/c/v keypress events.

View 2 Replies

VS 2008 - Annotating Functions / Sub Routines / Methods And Properties

Mar 25, 2010

Is there a way to annotate functions, subs, properties, and methods so that tool tips will pop-up in the IDE as they're being defined or selected?

View 2 Replies

VS 2010 : Multithreading And Accessing Other Routines/form Properties?

Mar 1, 2011

I'm writing a really simple file updater which downloads files off from a website and saves them. The download routine is working well, except that it freezes the project while attempting to connect to the host. Easily solved with threading except now when I try to access other form items such as text boxes, labels, form caption, it says I am not doing it in a safe manner and prompts an interrupt in debug. I did some reading on it and I'm still not sure what to do, I'm very new to vbnet and it is still a little confusing to me.

Error: Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.
Imports System.Threading
Imports System.Net
Imports System.IO

[code]....

View 8 Replies

Strings.format Command Fails In DataGridview Handler Routines?

Mar 7, 2011

The VB format(object,formatString) command fails when placed in the handler routines of a DataGridView.In the following procedure the newCellValue returns the Format string value instead of a formatted cell value.This pproblem occurs in both the dgv_CellFormatting and the dgv_CellClick routines.The same commands work properly when placed in a procedure on the form.

Private Sub dgv_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgv.CellFormatting
If e.FormattingApplied = False And Not e.CellStyle.Format = Nothing Then[code]...........

View 2 Replies

.net - Yield/Sleep/throttle Another Thread While It Is Executing A Method In An External Library - Specifically Jurassic?

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

DataGrid Columns Math - Result Return The Answer In The Unbound Yield Column For That Row Represented As A Percentage?

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

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

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

Forms :: Multiple Forms, Closing Events And Sub Routines?

May 25, 2010

I have googled high and low to find an answer to this but I must be searching wrong.I have an application which has a listview displaying some items that are stored in a SQL Compact database. I am using a second form to add new items to this list directly into the database.When the second form closes I want to call the sub in my first form to refresh the list from the database.

How can I get it to fire the form1 sub routine on the close event of form2

View 3 Replies

.net - Does C# Have A Handles Keyword

May 25, 2011

Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
End Sub

In VB.net, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved