hi,
i have this function..

Sub DrawScreen(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        Dim myPen As Pen
        myPen = New Pen(Color.Blue, 2)
        Dim gr As System.Drawing.Graphics = e.Graphics
        gr.DrawRectangle(myPen, 1 + x + (i * 4), y + (j * 4), 1 + x + (i * 4) + 3, y + (j * 4) + 3)
        Timer1.Start()
    End Sub

and i have to call it like this DrawScreen() from another function but the comipler is throwing error like this..

Error: Argument not specified for parameter 'e' of 'Public Sub DrawScreen(sender As Object, e As System.Windows.Forms.PaintEventArgs).

so please help me in making above function argument less... or tell me the way to call this function with arguments??????????

Hi,

I've made some changes and values to test your function.
Here's the result:

Public Class Form1
    Dim x As Integer = 50
    Dim i As Integer = 4
    Dim y As Integer
    Dim j As Integer = 10

    Sub DrawScreen()
        Dim gr As System.Drawing.Graphics = Me.CreateGraphics
        Dim myPen As New Pen(Color.Blue, 2)
        gr.DrawRectangle(myPen, (1 + x + (i * 4)), (y + (j * 4)), (1 + x + (i * 4) + 3), (y + (j * 4) + 3))
        Timer1.Start()

    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        DrawScreen()
    End Sub
End Class
This article has been dead for over six months. Start a new discussion instead.