2017年12月9日 星期六

VB2010 ListBox清單控制項應用




Public Class Form1

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Dim img As Image
        Dim imgStream As New IO.MemoryStream
        Dim fileName As String = "C:\Users\User\Documents\Visual Studio 2010\Projects\WindowsApplication3\WindowsApplication3\jpg\"
        Dim result As String

        Select Case ListBox1.TabIndex
            Case 0
                img = Image.FromFile(fileName & "i1.png")
                img.Save(imgStream, Drawing.Imaging.ImageFormat.Png)
                img.Dispose()
                PictureBox1.Image = Image.FromStream(imgStream)

                result = (fileName & "i1.txt")
                RichTextBox1.LoadFile(result, RichTextBoxStreamType.PlainText)

            Case 1
                img = Image.FromFile(fileName & "i3g.png")
                img.Save(imgStream, Drawing.Imaging.ImageFormat.Png)
                img.Dispose()
                PictureBox1.Image = Image.FromStream(imgStream)

                result = (fileName & "i3g.txt")
                RichTextBox1.LoadFile(result, RichTextBoxStreamType.PlainText)

        End Select
    End Sub


End Class

沒有留言:

張貼留言

WOKWI LED + MQTT Node-Red SQLite

WOKWI LED + MQTT Node-Red SQLite const char *mqtt_broker = "broker.mqtt-dashboard.com" ; const char *topic1 = "alex9ufo/e...