Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 766369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T17:02:14+00:00 2026-05-14T17:02:14+00:00

Hey all, i have made a simple form that mimiks the jQuery GROWL effect

  • 0

Hey all, i have made a simple form that mimiks the jQuery “GROWL” effect seen here http://www.sandbox.timbenniks.com/projects/jquery-notice/

However, i have ran into a problem. If i have more than one call to the form to display a “Growl” then it just refreshes the same form with whatever call i send it. In other words, i can only display one form at a time instead of having one drop down and a new one appear above it.

Here is my simple form code for the “GROWL” form:

Public Class msgWindow
Public howLong As Integer
Public theType As String
Private loading As Boolean

Protected Overrides Sub OnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs)
    Dim pn As New Pen(Color.DarkGreen)

    If theType = "OK" Then
        pn.Color = Color.DarkGreen
    ElseIf theType = "ERR" Then
        pn.Color = Color.DarkRed
    Else
        pn.Color = Color.DarkOrange
    End If

    pn.Width = 2
    pe.Graphics.DrawRectangle(pn, 0, 0, Me.Width, Me.Height)
    pn = Nothing
End Sub

Public Sub showMessageBox(ByVal typeOfBox As String, ByVal theMessage As String)
    Me.Opacity = 0
    Me.Show()
    Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 350, 15)

    Me.loading = True
    theType = typeOfBox
    lblSaying.Text = theMessage

    If typeOfBox = "OK" Then
        Me.BackColor = Color.FromArgb(192, 255, 192)
    ElseIf typeOfBox = "ERR" Then
        Me.BackColor = Color.FromArgb(255, 192, 192)
    Else
        Me.BackColor = Color.FromArgb(255, 255, 192)
    End If

    If Len(theMessage) <= 30 Then
        howLong = 4000
    ElseIf Len(theMessage) >= 31 And Len(theMessage) <= 80 Then
        howLong = 7000
    ElseIf Len(theMessage) >= 81 And Len(theMessage) <= 100 Then
        howLong = 12000
    Else
        howLong = 17000
    End If

    Me.opacityTimer.Start()
End Sub

Private Sub opacityTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles opacityTimer.Tick
    If Me.loading Then
        Me.Opacity += 0.07

        If Me.Opacity >= 0.8 Then
            Me.opacityTimer.Stop()
            Me.opacityTimer.Dispose()
            Pause(howLong)
            Me.loading = False
            Me.opacityTimer.Start()
        End If
    Else
        Me.Opacity -= 0.08

        If Me.Opacity <= 0 Then
            Me.opacityTimer.Stop()
            Me.Close()
        End If
    End If
End Sub

Public Sub Pause(ByVal Milliseconds As Integer)
    Dim dTimer As Date

    dTimer = Now.AddMilliseconds(Milliseconds)

    Do While dTimer > Now
        Application.DoEvents()
    Loop
End Sub
End Class

I call the form by this simple call:

Call msgWindow.showMessageBox("OK", "Finished searching images.")

Does anyone know a way where i can have the same setup but would allow me to add any number of forms without refreshing the same form over and over again?

Like always, any help would be great! 🙂

David

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T17:02:14+00:00Added an answer on May 14, 2026 at 5:02 pm

    This is one way of doing it, although there are probably better ways of managing it than this.

    Public Class Growl
    
    Private _notifications As New Dictionary(Of Integer, msgWindow)
    Private _count As Integer = 0
    
    Public Sub Remove(ByVal Sender As msgWindow, ByVal e As EventArgs)
        _notifications.Remove(CInt(Val(Sender.Name.Substring(1))))
        RefreshPositions()
    End Sub
    
    Private Sub RefreshPositions()
        Dim _top As Integer = 15
        For a As Integer = 0 To _count
            If _notifications.ContainsKey(a) Then
                _notifications.Item(a).Top = _top
                _top += _notifications.Item(a).Height + 20
            End If
        Next
    End Sub
    
    Public Sub ShowMessageBox(ByVal typeOfNotification As String, ByVal msg As String)
        Dim x As New msgWindow
        x.Name = "m" & _count
        AddHandler x.FormClosed, AddressOf Remove
        _notifications(_count) = x
        _count += 1
        x.showMessageBox(typeOfNotification, msg)
        RefreshPositions()
    End Sub
    
    End Class
    

    In your code, declare:

    Dim g as New Growl
    

    and call

    g.showMessageBox( ... , ... )
    

    instead of

    msgWindow.showMessageBox( ... , ... )
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, have a slight problem here. In CakePHP I have a controller that
Hey all. Here is the scenario. I have the below code, and I'm needing
Hey all- I have looked this up on here and Google but none of
hEY ALL i have a table that shows transactions and their status. How can
Hey all. I have a project that will require user input of anywhere from
hey all, I have made a socket server in C# for a flash game
hey all i have a problem in webservice that i am consuming. it takes
Hey all. I have the following code: http://jsfiddle.net/g7Cgg/ As you can see, there are
Hey all - I have an app where I'm authenticating the user. They pass
Hey all, I have something of an interesting requirement for my project. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.