All pastes #480045 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-10 01:22 UTC
rendered paste body
ublic Class Form1

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
        Dim strFileName As String
        Dim ret As DialogResult

        OpenFD.InitialDirectory = "C:\"
        OpenFD.Title = "Open a Text File"
        OpenFD.Filter = "Text Files(*.txt)|*.txt|Word Files(*.doc)|*.doc"
        ret = OpenFD.ShowDialog

        If ret = Windows.Forms.DialogResult.Cancel Then
            MsgBox("Cancel Button Clicked")
        Else
            strFileName = OpenFD.FileName
            MsgBox(strFileName)
        End If
    End Sub




    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
        Dim str As String = "abc123"
        Dim charCounts As New Dictionary(Of Char, Integer)

        For Each ch As Char In str
            If charCounts.ContainsKey(ch) Then
                charCounts(ch) += 1
            Else
                charCounts.Add(ch, 1)
            End If
        Next ch

        For Each entry As KeyValuePair(Of Char, Integer) In charCounts
            Form2.TextBox1.Text = entry.Key & " : " & entry.Value
        Next entry
        Form2.Show()
    End Sub
End Class