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??????????

Recommended Answers

All 2 Replies

Hey just remove the parameters. just use

sub DrawScreen

. It will work

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.