VB.Net Centering A Control
I am seriously confused as to why this isn't working.
I'm trying to create a resize sub for my form so that when you resize the form, all of the content resizes and places itself in the correct position.
I have a statement that is supposed to centre a label (not resized) within a panel on resize. But it always ends up significantly further right than I calculate it should be.
The offending line of code is......
Can anyone see what I am doing wrong?
lblRoomSelect.Left = pnlRoomSelect.Left + ((pnlRoomSelect.Width - lblRoomSelect.Width) / 2)
Or even suggest a better way of doing this?
Thanks in advance,