Click here to Skip to main content
15,905,028 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRe: How we can retrieve Gridvalue Pin
Richard MacCutchan20-May-16 1:43
mveRichard MacCutchan20-May-16 1:43 
GeneralRe: How we can retrieve Gridvalue Pin
Eddy Vluggen20-May-16 2:53
professionalEddy Vluggen20-May-16 2:53 
QuestionError in MsHflexGrid for rowcolchange event Pin
srikrishnathanthri19-May-16 0:52
srikrishnathanthri19-May-16 0:52 
AnswerRe: Error in MsHflexGrid for rowcolchange event Pin
Eddy Vluggen19-May-16 4:35
professionalEddy Vluggen19-May-16 4:35 
AnswerRe: Error in MsHflexGrid for rowcolchange event Pin
Dave Kreskowiak19-May-16 5:40
mveDave Kreskowiak19-May-16 5:40 
GeneralI need your VB6 programs! Pin
DutchComputerKid13-May-16 6:55
DutchComputerKid13-May-16 6:55 
GeneralRe: I need your VB6 programs! Pin
Dave Kreskowiak14-May-16 15:28
mveDave Kreskowiak14-May-16 15:28 
GeneralRe: I need your VB6 programs! Pin
DutchComputerKid16-May-16 16:53
DutchComputerKid16-May-16 16:53 
GeneralRe: I need your VB6 programs! Pin
Richard MacCutchan16-May-16 20:48
mveRichard MacCutchan16-May-16 20:48 
GeneralRe: I need your VB6 programs! Pin
DutchComputerKid17-May-16 3:19
DutchComputerKid17-May-16 3:19 
GeneralRe: I need your VB6 programs! Pin
Chris Quinn17-May-16 3:43
Chris Quinn17-May-16 3:43 
QuestionRe: I need your VB6 programs! Pin
ZurdoDev19-May-16 5:48
professionalZurdoDev19-May-16 5:48 
AnswerRe: I need your VB6 programs! Pin
DutchComputerKid19-May-16 14:34
DutchComputerKid19-May-16 14:34 
GeneralRe: I need your VB6 programs! Pin
Johan Hakkesteegt20-May-16 0:27
Johan Hakkesteegt20-May-16 0:27 
GeneralRe: I need your VB6 programs! Pin
DutchComputerKid20-May-16 0:53
DutchComputerKid20-May-16 0:53 
GeneralRe: I need your VB6 programs! Pin
Chris Quinn20-May-16 3:16
Chris Quinn20-May-16 3:16 
GeneralRe: I need your VB6 programs! Pin
DutchComputerKid20-May-16 6:27
DutchComputerKid20-May-16 6:27 
GeneralRe: I need your VB6 programs! Pin
DutchComputerKid20-May-16 9:53
DutchComputerKid20-May-16 9:53 
GeneralRe: I need your VB6 programs! Pin
DutchComputerKid2-Sep-16 0:07
DutchComputerKid2-Sep-16 0:07 
GeneralRe: I need your VB6 programs! Pin
Chris Quinn2-Sep-16 1:16
Chris Quinn2-Sep-16 1:16 
GeneralRe: I need your VB6 programs! Pin
DutchComputerKid2-Sep-16 2:19
DutchComputerKid2-Sep-16 2:19 
QuestionAdding Items to data-bound Combo Box Pin
Raabi Anony12-May-16 20:06
Raabi Anony12-May-16 20:06 
AnswerRe: Adding Items to data-bound Combo Box Pin
Dave Kreskowiak13-May-16 1:07
mveDave Kreskowiak13-May-16 1:07 
QuestionTranslating and understanding what this code block does in c#, adn see if I translated it right for me to use. Pin
jkirkerx12-May-16 13:52
professionaljkirkerx12-May-16 13:52 
AnswerRe: Translating and understanding what this code block does in c#, adn see if I translated it right for me to use. Pin
Richard Deeming13-May-16 2:10
mveRichard Deeming13-May-16 2:10 
The code translator seems to have screwed up the event handler. The C# code:
C#
sender.SendEmailCompleted += (o, eventArgs) 
  => Console.WriteLine(eventArgs.RetryCount);

would translate as something like this:
VB.NET
AddHandler sender.SendEmailCompleted, Sub(ByVal sender As Object, ByVal e As SendEmailCompletedEventArgs)
    Console.WriteLine(eventArgs.RetryCount)
End Sub


If you're using .NET 4.5 or later, I'd be inclined to use an Async[^] method, and use the SmtpClient.SendMailAsync method[^]:
VB.NET
Public Async Function SendEmailAsync(ByVal smtpClient As SmtpClient, ByVal message As MailMessage, ByVal retryCount As Integer) As Task(Of SendEmailCompletedEventArgs)
    Dim currentTry As Integer = 0
    While currentTry < retryCount
        Try
            Await smtpClient.SendMailAsync(message)
            Return New SendEmailCompletedEventArgs(Nothing, False, Nothing, currentTry)
            
        Catch exception As Exception
            currentTry += 1
            If currentTry >= retryCount Then
                Return New SendEmailCompletedEventArgs(ex, True, Nothing, currentTry)
            End If
        End Try
    End While
    
    ' Code should never reach here, but without this line you'll get a BC42105 warning:
    Return New SendEmailCompletedEventArgs(Nothing, True, Nothing, currentTry)
End Function

Your calling code can then use a Using block to clean up the SmtpClient and MailMessage instances:
VB.NET
Public Async Function SendAllMessages() As Task
    Using smtpClient As SmtpClient = CreateSmtpClient()
        For Each item As SomeType In SomeListOfData
            Using message As MailMessage = CreateMessageFor(item)
                Dim result As SendEmailCompletedEventArgs = Await SendEmailAsync(smtpClient, message, RetryCount)
                ProcessSendResult(item, result)
            End Using
        Next
    End Using
End Function




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


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.