Click here to Skip to main content
15,887,746 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionPrinting invoice in Continuous stationery in usb dot matrix in VB6 Pin
imagetvr12-Dec-15 21:31
imagetvr12-Dec-15 21:31 
AnswerRe: Printing invoice in Continuous stationery in usb dot matrix in VB6 Pin
Dave Kreskowiak13-Dec-15 5:12
mveDave Kreskowiak13-Dec-15 5:12 
QuestionVB.NET DUPLICATE SCREEN SHARING PROBLEM Pin
Steve Roseik12-Dec-15 7:58
Steve Roseik12-Dec-15 7:58 
GeneralRe: VB.NET DUPLICATE SCREEN SHARING PROBLEM Pin
CHill6013-Dec-15 2:36
mveCHill6013-Dec-15 2:36 
GeneralRe: VB.NET DUPLICATE SCREEN SHARING PROBLEM Pin
Steve Roseik13-Dec-15 8:06
Steve Roseik13-Dec-15 8:06 
GeneralRe: VB.NET DUPLICATE SCREEN SHARING PROBLEM Pin
CHill6013-Dec-15 8:15
mveCHill6013-Dec-15 8:15 
GeneralRe: VB.NET DUPLICATE SCREEN SHARING PROBLEM Pin
Steve Roseik20-Dec-15 7:31
Steve Roseik20-Dec-15 7:31 
QuestionUsing Await Pin
jkirkerx10-Dec-15 14:02
professionaljkirkerx10-Dec-15 14:02 
I'm new to await, and have always had trouble understanding it. Like I make an await function, and then VS 2013 Tells me to make the calling function await, and just keeps moving up the chain.

So this time I did some research on it.
http://stackoverflow.com/questions/14888984/start-async-task-without-using-await-in-called-method[^]

In the link above, there's 2 examples, and I found the 2nd one easier to understand.
But I'm wondering if I should use example 1 instead. What do you think?

Here's what I have. i'd like to be able to check on the status, and have it update the form with emails sent and status, if it's still running and complete, so I can change the form color back. Not sure if I'm on the right track, and wanted to check before I write more code. But so far so good, it works.
Public Enum _smtpEngine_Status

    STOPPED = 1
    START_PENDING = 2
    STOP_PENDING = 3
    RUNNING = 4
    CONTINUE_PENDING = 5
    PAUSE_PENDING = 6
    PAUSED = 7
    COMPLETE = 8
    EMPTY = 9

End Enum
Public Class smtp_send_engine

    '<a href="http://stackoverflow.com/questions/14888984/start-async-task-without-using-await-in-called-method">http://stackoverflow.com/questions/14888984/start-async-task-without-using-await-in-called-method</a>

    Public Shared engineTask As Task

    Public Shared Function engineStart( _
        ByVal pSend As frmSend,
        ByVal pJobID As Integer,
        ByVal pPageIndex As Integer,
        ByVal pPageSize As Integer) As _smtpEngine_Status

        Dim pValue As _smtpEngine_Status = _smtpEngine_Status.START_PENDING

        'No need for sub to be async but can be async if needed for other reasons (see below)
        'but that doesn't stop the execution in the CallingSub
        'Get the task started... it's not going to wait for the task to be done just sets the task variable
        engineTask = engineRun( _
            pSend,
            pJobID,
            pPageIndex,
            pPageSize
        )

        Return pValue

    End Function
    Public Shared Async Sub engineStatus()

        'Must be async so you can await the result
        Await engineTask

        'Do stuff that requires task to be done

    End Sub
    Private Shared Async Function engineRun( _
        ByVal pSend As frmSend,
        ByVal pJobID As Integer,
        ByVal pPageIndex As Integer,
        ByVal pPageSize As Integer) As Task(Of _smtpEngine_Status)

        'No need for this function to be async since the function has no await
        Dim pValue As _smtpEngine_Status = _smtpEngine_Status.START_PENDING

        Dim responseCount As New crm.ws_sendEngine_subscribersCount_response
        Dim dwXCode As Integer = request_sendEngine_Count.get_Subscriber_Count(responseCount)

        If Not (responseCount.count > 0) Then
            Return _smtpEngine_Status.EMPTY
            Exit Function
        Else
            Await Task.Delay(30000)
            pValue = _smtpEngine_Status.COMPLETE
        End If

        Return pValue

    End Function

End Class

AnswerRe: Using Await Pin
CHill6012-Dec-15 4:02
mveCHill6012-Dec-15 4:02 
GeneralRe: Using Await Pin
jkirkerx12-Dec-15 13:57
professionaljkirkerx12-Dec-15 13:57 
GeneralRe: Using Await Pin
CHill6013-Dec-15 2:35
mveCHill6013-Dec-15 2:35 
AnswerWell here's what I ended up with Pin
jkirkerx13-Dec-15 12:30
professionaljkirkerx13-Dec-15 12:30 
QuestionLINQ group By Pin
byka8-Dec-15 4:58
byka8-Dec-15 4:58 
QuestionBuild this as a separate project within the project Pin
jkirkerx7-Dec-15 11:18
professionaljkirkerx7-Dec-15 11:18 
AnswerRe: Build this as a separate project within the project Pin
Wombaticus7-Dec-15 11:33
Wombaticus7-Dec-15 11:33 
GeneralRe: Build this as a separate project within the project Pin
jkirkerx7-Dec-15 11:59
professionaljkirkerx7-Dec-15 11:59 
GeneralRe: Build this as a separate project within the project Pin
Wombaticus7-Dec-15 12:08
Wombaticus7-Dec-15 12:08 
GeneralRe: Build this as a separate project within the project Pin
jkirkerx8-Dec-15 12:30
professionaljkirkerx8-Dec-15 12:30 
QuestionPrinting in Visual Studio 2015 Pin
DelboyKent5-Dec-15 5:29
DelboyKent5-Dec-15 5:29 
AnswerRe: Printing in Visual Studio 2015 Pin
Dave Kreskowiak5-Dec-15 6:35
mveDave Kreskowiak5-Dec-15 6:35 
Questionftp/tcp for Windows CE 5.0 Pin
tclacla4-Dec-15 10:27
tclacla4-Dec-15 10:27 
AnswerRe: ftp/tcp for Windows CE 5.0 Pin
Garth J Lancaster4-Dec-15 12:01
professionalGarth J Lancaster4-Dec-15 12:01 
Questionhelp with linq query Pin
byka4-Dec-15 2:56
byka4-Dec-15 2:56 
AnswerRe: help with linq query Pin
Richard Deeming4-Dec-15 4:15
mveRichard Deeming4-Dec-15 4:15 
GeneralRe: help with linq query Pin
byka4-Dec-15 5:07
byka4-Dec-15 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.