Click here to Skip to main content
15,888,341 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWindow Service Does Not Stay "Alive" While Running Pin
ToolTimeTabor14-May-14 15:13
ToolTimeTabor14-May-14 15:13 
AnswerRe: Window Service Does Not Stay "Alive" While Running Pin
Bernhard Hiller14-May-14 21:51
Bernhard Hiller14-May-14 21:51 
AnswerRe: Window Service Does Not Stay "Alive" While Running Pin
Eddy Vluggen15-May-14 3:00
professionalEddy Vluggen15-May-14 3:00 
AnswerRe: Window Service Does Not Stay "Alive" While Running Pin
David Mujica15-May-14 6:25
David Mujica15-May-14 6:25 
QuestionIf/and Statements Pin
David Rubin13-May-14 12:34
David Rubin13-May-14 12:34 
AnswerRe: If/and Statements Pin
Peter Leow13-May-14 14:33
professionalPeter Leow13-May-14 14:33 
AnswerRe: If/and Statements Pin
charliedev14-May-14 19:20
charliedev14-May-14 19:20 
Questionsave images as .gif Pin
khei-chan00712-May-14 17:44
khei-chan00712-May-14 17:44 
Hi guys,
i have codes that displaying different images as gif in one picturebox. My problem is, how can i save this .gif i mydocuments?
here is my codes..

thank you in advance! Smile | :)

VB
Public Class Form7

    Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.BackColor = Color.Ivory
        PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox1.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox2.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox3.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox4.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox5.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox6.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox7.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            TextBox8.Text = (OpenFileDialog1.FileName)
        End If
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

        Timer1.Enabled = True
        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Dim max As Integer = 500
        Dim rnd As New Random
        Dim rand As Integer = rnd.Next(5, max + 1)

        Dim i As Integer = 1
        Dim number(max - 1) As Integer
        For i = 0 To max - 1
            If number(i) = rand Then
                rand = rnd.Next(1, max + 1)
                i = -1
            ElseIf number(i) = 0 Then
                number(i) = rand
                rand = rnd.Next(1, max + 1)
                If i = max - 1 Then
                    Exit For
                End If
                i = -1
            End If
        Next
        Timer1.Interval = number(i)
        i += 1
        ChangeImage()

    End Sub

    Private Sub ChangeImage()

        Static Dim iImage1 As Integer

        Select Case iImage1
            Case 0
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox1.Text)
                iImage1 += 1
            Case 1
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox2.Text)
                iImage1 += 1
            Case 2
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox3.Text)
                iImage1 += 1
            Case 3
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox4.Text)
                iImage1 += 1
            Case 4
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox5.Text)
                iImage1 += 1
            Case 5
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox6.Text)
                iImage1 += 1
            Case 6
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox7.Text)
                iImage1 += 1
            Case 7
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox8.Text)
                iImage1 += 1
            Case 8
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox9.Text)
                iImage1 += 1
            Case 9
                PictureBox1.Visible = True
                PictureBox1.Image = Image.FromFile(TextBox10.Text)
                iImage1 = 0
        End Select
    End Sub

End Class


modified 13-May-14 3:20am.

AnswerRe: save images as .gif Pin
Chris Quinn12-May-14 20:56
Chris Quinn12-May-14 20:56 
GeneralRe: save images as .gif Pin
khei-chan00712-May-14 21:25
khei-chan00712-May-14 21:25 
GeneralSaving Image as Gif Pin
I. Bandaranayake13-May-14 1:49
I. Bandaranayake13-May-14 1:49 
AnswerRe: save images as .gif Pin
Richard MacCutchan12-May-14 22:47
mveRichard MacCutchan12-May-14 22:47 
QuestionMapWinGis project in Visual Basic.NET Pin
Member 1081056711-May-14 7:32
Member 1081056711-May-14 7:32 
QuestionVB CODE TO RECEIVE SMS THROUGH GSM MODEM Pin
elly ianto10-May-14 2:34
elly ianto10-May-14 2:34 
AnswerRe: VB CODE TO RECEIVE SMS THROUGH GSM MODEM PinPopular
Dave Kreskowiak10-May-14 3:38
mveDave Kreskowiak10-May-14 3:38 
GeneralRe: VB CODE TO RECEIVE SMS THROUGH GSM MODEM Pin
elly ianto12-May-14 3:24
elly ianto12-May-14 3:24 
Questionentity framework too slow executing even a small query Pin
dilkonika9-May-14 14:11
dilkonika9-May-14 14:11 
AnswerRe: entity framework too slow executing even a small query Pin
Dave Kreskowiak10-May-14 3:43
mveDave Kreskowiak10-May-14 3:43 
GeneralRe: entity framework too slow executing even a small query Pin
dilkonika10-May-14 8:49
dilkonika10-May-14 8:49 
GeneralRe: entity framework too slow executing even a small query Pin
Dave Kreskowiak10-May-14 11:10
mveDave Kreskowiak10-May-14 11:10 
GeneralRe: entity framework too slow executing even a small query Pin
dilkonika11-May-14 5:45
dilkonika11-May-14 5:45 
GeneralRe: entity framework too slow executing even a small query Pin
Dave Kreskowiak11-May-14 5:55
mveDave Kreskowiak11-May-14 5:55 
GeneralRe: entity framework too slow executing even a small query Pin
dilkonika11-May-14 7:17
dilkonika11-May-14 7:17 
QuestionHow to create a file Pin
ShadowsrayChamhell9-May-14 5:45
ShadowsrayChamhell9-May-14 5:45 
AnswerRe: How to create a file Pin
Simon_Whale9-May-14 5:50
Simon_Whale9-May-14 5:50 

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.