Click here to Skip to main content
15,888,242 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I add a value to PointF()correctly ? like
VB
Dim pts as PointF()


What I have tried:

I have tried this:
VB
pts={New PointF(x,y)}
but I got "System.ArgumentException: Parameter is not valid".
Posted
Updated 21-Jun-21 7:05am
v2

Try this...
VB
Dim pts As New PointF(X, Y)
 
Share this answer
 
Comments
molali 4-Dec-16 8:40am    
It didn't work,It must be an array. I am applying that "pts" on "gfx.Drawlines(Pens.blue, pts)", so it must be "Dim pts As PointF()or Dim pts As Point()"
I just shared what I got from official doc. If you need an array, then declare like that.
you can try:
dim pts() as PointF = {}
dim pt as point
pt.x=10
pt.y=20
pts.add(pt)
 
Share this answer
 
Comments
CHill60 22-Jun-21 8:22am    
Reasons for my downvote (I can't speak for the others)
1. This won't even compile - "'add' is not a member of 'System.Array'."
2. If you fix point 1 you will then get another error "Index was outside the bounds of the array."
3. That is not how arrays should be declared. I suggest you read Arrays - Visual Basic | Microsoft Docs[^]
Dim pt As Point = New Point(10,20)
Dim pts() As PointF = {pt}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900