If all you want to do is draw in teh picturebox then :
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim g As Graphics = e.Graphics
g.DrawString("TEST", New Font("Arial", 12, FontStyle.Bold), New
SolidBrush(Color.Black), 1, 1)
End Sub
will do it
Steven
"Cyberdot" <(E-Mail Removed)> wrote in message
news

5B6DEA5-B5D2-4B89-991C-(E-Mail Removed)...
> Yeah, I tried it and it works. But now I have another problem. I have a
> picturebox on the same position where I want to draw the string, and it
> looks
> like the picture box is in front of the string I've drawn. Is there a
> method
> to get the graphics handler for a picturebox?
>
> Thx,
> Cyberdot
>
> "Peter Foot [MVP]" wrote:
>
>> Because you haven't instantiated g, just created a variable to hold a
>> Graphics object. You can use
>>
>> g = Me.CreateGraphics()
>>
>> To get the Graphics instance for your form, which you will then be able
>> to
>> draw with. You would probably be best to add this drawing code into your
>> OnPaint override for the form, then invalidate the form when the value
>> changes.
>>
>> Peter
>>
>> --
>> Peter Foot
>> Windows Embedded MVP
>> www.inthehand.com | www.opennetcf.org
>>
>> Do have an opinion on the effectiveness of Microsoft Windows Mobile and
>> Embedded newsgroups? Let us know!
>> https://www.windowsembeddedeval.com/...ity/newsgroups
>>
>> "Cyberdot" <(E-Mail Removed)> wrote in message
>> news:44F9F156-0629-4DA3-B0D7-(E-Mail Removed)...
>> > Hello,
>> > I've got a little problem. I want to draw a string to my form with the
>> > follówing code:
>> >
>> > Public Sub titleSetTime(ByVal newTime As String)
>> > Dim g As System.Drawing.Graphics
>> > g.DrawString(newTime, New System.Drawing.Font("Microsoft Sans
>> > Serif", 10, System.Drawing.FontStyle.Regular), New
>> > SolidBrush(SystemColors.ControlText), 200, 2)
>> > End Sub
>> >
>> > But if I try this, I get a SystemNullReferenceExeption. Does sombody
>> > know
>> > why?
>> >
>> > Thx,
>> > Cyberdot
>>
>>
>>